Search⌘ K
AI Features

Project Setup: Part Two

Explore how to continue setting up a Node.js project by installing Express and managing dependencies using npm. Understand creating a .gitignore file to exclude node_modules and environment variables from Git. Learn to organize server-side code in a src folder and configure a basic Express server running on port 8080. This lesson prepares you to build a RESTful API with Express effectively.

The following tasks continue where we left off in the previous lesson.

Task 3: Install project dependencies

Let’s install Express for our project as follows:

Shell
npm install express

What does running the above command create in our folder?

A new folder called node_modules is created. It’s the folder where npm installs the packages the project needs, such as dependencies.

The express package is installed in the current file tree under the node_modules subfolder.

As this happens, npm also adds the express entry in the dependencies property of the package.json file present in the current folder.

Finally, a package-lock.json file is also created.

To see the latest version of all ...