Node.js / Express.js - initialize express project

0 points
Created by:

In this article, we would like to show you how to initialize express.js project step by step.

1. Install Node.js on your PC

2. Open an empty folder for your project

3. Open terminal with the project destination

4. Create package.json file

npm init -y


The -y flag is used to use the default values, so we won't need to answer any questions.

5. Install express

npm i express

6. Inside your project folder create index.js file

7. Import express, initialize app and make it listen on specified port (in our case http://localhost:5000)

Index.js file:

const express = require('express'); // import express

const app = express(); // initialize app

app.listen(5000); // make the app listen on specified port

Now your server is set up and listening for request. Check the See also section below to learn how to write express.js requests.

See also

Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂