Created
February 21, 2016 10:34
-
-
Save diem1/8c300d2d6017e5421d38 to your computer and use it in GitHub Desktop.
NodeJS JSON response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var server = new http.Server(function(req, res){ | |
res.setHeader('Content-Type', 'application/json'); | |
var json = JSON.stringify({ | |
foo: "bar" | |
}); | |
res.end(json); | |
}).listen(3333); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment