Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.get('/', function(req, res) {
  2.     //res.write(json); is good but we need to call res.end() to end the response
  3.     //what i really should have done is this:
  4.     res.writeHead(200, {"Content-Type": "application/json"}); // not sure if this line is needed!
  5.     res.end(json);
  6.  
  7.  
  8.     // res.end(json); is equal to: res.write(json); res.end();
  9. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement