# Express.js framework & Node.js

In 
Published 2022-12-03

This tutorial explains to you what Express.js framework is and how you can use it with Node.js. This article provides you with an example as well.

Express is one of the best frameworks for Node.js. Express is a fast, robust and asynchronous framework like Node.js.

Express framework can be used to:

  • create single-page, multi-page and hybrid web applications
  • setup middleware engines to respond to HTTP Requests
  • define a routing table which is used to perform different actions based on HTTP method and URL
  • create dynamic HTML Pages based on passing arguments to templates
  • work with databases (SELECTs, UPDATEs, INSERTs, DELETEs, etc)

Express is a powerful and efficient server-side framework. Angular is a powerful and efficient framework too, but it is built to run on the client side.

Express is a package for Node.js. You can install the Express into Node.js using the Node Package Manager (NPM):

Here it is a Hello World example written in Express:

var express = require('express');
 
var app = express();
app.get('/', function (req, res) {
  res.send('Hello World!');
});
app.listen(2000, function () {
  console.log('Example app listening on port 2000!');
});

When you run you see the following into the console:

In the browser you can see:

In the browser you can see also on another URL defined in Express application:

So, Express is a nice framework for creating web and middleware applications, and in the same time keeping the advantages of Node.js.