Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.


Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Search from all Lessons

LoginGet Started
← Back to Lessons
  • node

  • javascript

  • express-generator

  • express

Edit on Github

Introduction to Express Generator


What is Express Generator?

The express-generator package helps a lot in developing web applications with Node; it generates the application structure. A small disadvantage is that when generating the code, we don't know how to change some basic things, for example, the port on which the app listens (default is port 3000).

Install Express Generator

To install express generator we can run the following command.

1$ npm i -g express-generator

Start a project with express generator

To start a new project with express generator we can run the following command, which will generate a project structure:

1$ express --pug webapp

Express generator directory structure

When we create our app with express generator we get the following directory structure, which contains all the necessary files to start the project, using as pug. templating engine within the other template engines, we have ejs, hts

- webapp
    - bin
    - public
    - routes
    - views
    - app.js
    - package.json

Install dependencies

To install all the basic dependencies for the operation of our web, we access the main directory and run the following command:

1$ npm install

Start our express generator Website

To start our web project we have to execute the following command:

1$ npm run start