Install Express in a Node Project
Last Updated :
20 Sep, 2025
ExpressJS is a popular, lightweight web framework for NodeJS that simplifies the process of building web applications and APIs. It provides a robust set of features for creating server-side applications, including routing, middleware support, and easy integration with databases and other services.
Before adding Express to your project, ensure that NodeJS is installed on your system. For detailed installation instructions, you can refer to this guide: --> Here
Install Express in a Node Project
Step 1: Navigate to Your Project Directory
Open your terminal or command prompt and move to your project's root directory
cd path-to-your-porject
Step 2: Initialize the NodeJS Project
Set up your project by creating a package.json file
npm init -y
This command initializes the project with default settings, creating a package.json file that manages your project's dependencies and metadata.
Step 3: Install ExpressJS
Add ExpressJS to your project
npm install express
This installs the ExpressJS framework and adds it to the dependencies section of your package.json.
Step 4: Create a Basic Express Server
In your project directory, create a file named app.js and add the following code
JavaScript
const express = require('express');
const app = express();
const PORT = 3000;
app.get('/', (req, res) => {
res.send('Hello, Geeks!');
});
app.listen(PORT, () => {
console.log(`Server is listening at http://localhost:${PORT}`);
});
Step 5: Start the Server
Run your server with the following command
node server.js
Terminal Output
Terminal OutputWeb Browser Output
When you navigate to http://localhost:3000 in your web browser, you should see:
Hello Geeks
Explore
Node.js Tutorial
4 min read
Introduction & Installation
Node.js Modules , Buffer & Streams
Node.js Asynchronous Programming
Node.js NPM
Node.js Deployments & Communication
Resources & Tools