EN
Express.js - create new project
3
points
In this article, we would like to show you how to create new project for Express.js.
Prerequirements:
- installed Node.js on used computer
Installation instruction:
Simple steps:
- create new directory,
- open terminal and go to the diretory,
- create package.json file using the command:
npm init -y
Note:
-y
flag makes default values using, so we won't need to answer any questions. - install express package using the command:
npm i express
- create index.js file inside the directory and use source code:
const express = require('express'); // imports Express.js module const app = express(); // initializes application app.listen(5000); // runs server on specified port
- run index.js fil using the command:
node index.js
- open the link http://localhost:5000 in a web browser.
Screenshot: