Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #node #js #return #json
ADD COMMENT
Topic
Name
9+7 =