Sunday, 19 March 2017

In node.js res.send is returns nothing

I am using the latest version of Node.js with version 6.10.0 and npm version is 3.10.10 using express framework, just writing a sample api to send the text "Hello World". I tested it in postman and it doesn't return any data. When I use console.log, it displays the data on command prompt.

Code:

app.get('/api/hello',function(req,res){
    console.log("hello world") 
    res.send("hello world")
 res.status(200).send("hello world")  // it is also not working
})

Please help me solve this problem. Thanks.



via Mahesh

No comments:

Post a Comment