4Geeks logo
About us

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.

Data Science and Machine Learning - 16 wks

Full-Stack Software Developer - 16w

Search from all Lessons

Social & live learning

The most efficient way to learn: Join a cohort with classmates just like you, live streams, impromptu coding sessions, live tutorials with real experts, and stay motivated.

← Back to Lessons
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