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.
Create and set up a Node.js project - JavaScript Tutorial
From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext
Create and set up a Node.js project
- Okay, so now that we know a little bit more about what our server is going to do, let's start creating it. The first thing we're going to do is create and set up the project that all our source code is going to be in. So in order to do that, open up the IDE of your choice. The one I'm going to be using is Visual Studio Code, which has a built-in terminal that I'll be using, as well. And what we're going to do is create a new folder, and we'll call that folder something like node-rest-api. And once we've done that, click Open, and now it's time to set up our project so that it'll run correctly. The first thing we have to do is open up a terminal inside this folder. Make sure you really are running these commands inside the correct folder. That happens to me sometimes. And what we're going to do is run npm init -y, which initializes this folder as a new npm package and creates this package.json file for us that contains a little bit of information about our project. And once we've…
Contents
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Learning objectives1m 34s
-
(Locked)
Learn the basics of writing a Node server3m 52s
-
(Locked)
Create and set up a Node.js project3m 59s
-
(Locked)
Create and run a basic Express server5m 47s
-
(Locked)
Create and test a GET endpoint6m 27s
-
(Locked)
Read a file with the fs package4m 40s
-
(Locked)
Create and test a POST endpoint8m
-
(Locked)
-
-
-