Languages
[Edit]
EN

Express.js - create new project

3 points
Created by:
Imaan-Morin
1009

In this article, we would like to show you how to create new project for Express.js.

 

Prerequirements:

 

Simple steps:

  1. create new directory,
  2. open terminal and go to the diretory,
  3. 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.
  4. install express package using the command:
    npm i express
  5. 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
  6. run index.js fil using the command:
    node index.js
  7. open the link http://localhost:5000 in a web browser.

 

Screenshot:

Example Express.js application without any routes.
Example Express.js application without any routes.

 

See also

  1. Node.js / Express.js - AJAX GET request

  2. Node.js / Express.js - AJAX POST request

  3. Node.js / Express.js - AJAX DELETE request

  4. Node.js / Express.js - AJAX PUT request

  5. Node.js / Express.js - AJAX PATCH request

Alternative titles

  1. Express.js - initialize Express.js app
  2. Express.js - create backend application
  3. Express.js - initialize new project
  4. Express.js - initialize new application
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
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.

❤️💻 🙂

Join