Loading

Quipoin Menu

Learn • Practice • Grow

express-js / Express.js Installation
tutorial

Express.js Installation

Now that your environment is ready, it's time to install Express.js in your project. There are two ways to do this: manually installing Express or using the Express Generator tool. Let's learn both methods.

Method 1: Manual Installation (Recommended for Learning)

This method gives you full control and helps you understand the project structure better.

Step 1: Initialize npm in your project
npm init -y

This creates a package.json file with default settings. This file tracks your project dependencies and scripts.

Step 2: Install Express
npm install express

This downloads Express and adds it to your package.json dependencies. You'll see a node_modules folder and package-lock.json file.

Method 2: Using Express Generator (For Larger Projects)

Express Generator creates a complete project structure with all the boilerplate code.

Step 1: Install Express Generator globally
npm install -g express-generator

Step 2: Generate a new Express app
express my-app --view=ejs

This creates a folder called my-app with a complete Express app using EJS as the template engine.

Step 3: Install dependencies
cd my-app
npm install

What Gets Installed?

After installation, your project will have:
  • node_modules/ – Contains all Express and its dependencies.
  • package.json – Lists Express as a dependency.
  • package-lock.json – Locks exact versions for consistent installs.

Two Minute Drill

  • Run `npm init -y` to create package.json.
  • Install Express with `npm install express`.
  • Express Generator (`express-generator`) creates complete project structures.
  • Manual installation is better for learning; generator is great for production apps.

Need more clarification?

Drop us an email at career@quipoinfotech.com