Search⌘ K
AI Features

Setting up the Start Scripts and Running the Server

Explore configuring environment ports, integrating the Express framework, and setting up start scripts using nodemon to run your NodeJS backend server efficiently. Understand how to bind the server to a port and confirm it's running properly.

We'll cover the following...

Previously, we set up our backend’s structure and architecture and installed all the necessary npm packages. To start our Node.js application in this lesson, we need to require the Express framework in our server.js file. However, before we do that, let us set up the server port.

Setting up the port

Inside our .env file, we configured our server to run on port 5000, which means we’ll create a variable in our server.js file to have access to this port. Following is how we do ...