Instagram
youtube
Facebook
Twitter

Introduction

Introduction

  • Express.js is a web framework for Node.js that provides a robust set of features to develop web and mobile applications.
  • It is used to design single-page, multi-page, and hybrid web applications.
  • It supports the dynamic render HTML pages based on passing arguments.
  • It allows the setup of middleware to respond to the HTTP request.
  • It is used to define a routing table that is used to perform different actions based on the HTTP method and URL. 

Core Features of Express

  • It can be used to design single-page, multi-page, and hybrid web applications.
  • It allows the setup of middleware to respond to HTTP Requests.
  • It defines a routing table that is used to perform different actions based on the HTTP method and URL.
  • It allows to dynamically render HTML Pages based on passing arguments to templates.

Installing Express

Commands to install the Express framework using NPM:

$ npm install express --save

Example:

  • Basic Example of Express.Js Hello World
var express = require('express');
var app = express();

app.get('/', function(req, res){
   res.send("Hello world!");
});

app.listen(3000);
  • Save the code and run the command
$ node server.js

Output

Hello world