Node js first app

technical talkiess
0

 


  1. App first project

const express = require('express')


const app = express()


const port  = 8080


// ye wali get method hai

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

    res.send("This is my first app");

})

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

    res.send("This is my first app about page");

})

// niche wlai post method hai

app.post("/about",(req,res)=>{

    res.send("This is my first app about page");

})


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

    // apko agar status code send karna hai to aap aise bhej sakte hai

    res.status(200).send("This is my first app about page");

})


app.listen(port,()=>{

    console.log(`The server is run on the port no ${port}`)

})


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)