how to return status: "ok" along with json data in nodejs code example
Example 1: node js return json
var http = require('http');
var app = http.createServer(function(req,res){
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify({ a: 1 }));
});
app.listen(3000);
// > {"a":1}
Example 2: express set response code
res.status(400);
res.send('None shall pass');