Render the value in Nodejs Server HTML Document and JSON

 const express=require('express');


const app=express();

app.get('',(req,resp)=>{
    console.log("The data ",req.query);
    resp.send(`<h1> hello, This is HOME Page </ h1>
    <a href="/about">about page </a>
    `);
});

app.get('/about',(req,resp)=>{
    resp.send(`
    <input type="text" placeholder="enter your value">
    <button>click me</button>
    <a href='/' >back to home</a>
    `);
});

app.get('/help',(req,resp)=>{
    resp.send([
        {
            name:'anand',
            email:'annad@gmail.com'
        },{
            name:"dilip",
            email:'dilip@gmail.com'
        }
    ]);
})

app.listen(4000);

Post a Comment

0 Comments