Basic node express api

Very first we need to create a node application and install express

Installing express

npm i express

If you don't know how to create a node application check this link bellow

Create a node application 

Create a js file under root folder in this case I am going to put file name index

index.js

import express from "express";
const app = express();

//get request
app.get("/", (req, res) => {

  res.send("Hello World");

})

app.listen(5000, () => {

  console.log(`Server is running on port 5000`);

})

 

About Author

Photo

Hi, I am Mahbub Hasan
Software Engineer

I am very much interested to share my programming
and development knowledge with the people.I will try
to update my blog everyday with new technology inshallah.

Thank You

For Visiting My Blog.

Contact Me