From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext

Unlock this course with a free trial

Join today to access over 25,000 courses taught by industry experts.

Learn the basics of writing a Node server

Learn the basics of writing a Node server

- Earlier in the course, we saw how to run JavaScript in a browser and also how to run it on a server using Node.js. In this section, we're going to go a little deeper with the practical application of JavaScript and see how to use it to write a very simple REST API. Now, you may or may not be familiar with what exactly a REST API is, and I'll admit that explaining this fully is a little beyond the scope of this course. But here's a very simplified rundown. With most full stack applications, which are in the overwhelming majority these days, we almost never want to store our applications data on the client side. We usually want to have our server take care of creating, reading, updating and deleting data, which allows us to consolidate the data of all of our users in a single place. What a REST API is then is a sort of standardized way for the client side and our server to interact with each other in these situations. For example, in order to access some resource from the server, say…

Contents