Express Js Node Js Example

npm init
npm install express

Hello World Example

Create app.js file with following code.

const express = require("express");
const app = express();
const port = 3000;

app.get("/", (req, res) => {
  res.send("Hello World!");

app.listen(port, () => {
  console.log(`Server listening at http://localhost:${port}`);

We can use Express application generator also.

npx express-generator

npm start


Basic Routing

Leave a Reply

Your email address will not be published. Required fields are marked *