Creating a Simple Web Application with Node.js and Express Framework

Suraj khadekar
0

 


Create a simple Node.Js application using the Express framework using the following steps.

  1. Create a folder with the name NodeFirstApp.
  2. Open the folder in Visual Studio Code.
  3. Open Terminal
  4. Type Command npm init (It will initialize package.json). Just enter the questions they all are optional.
  5. Create a File with the name index.js and add the below code to it.

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

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

app.listen(3000, function () {
    console.log("Running on port 3000");
})


6. Run the code by typing the command Node index.js

Output:




Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!