Skip to content

Instantly share code, notes, and snippets.

@montogeek
Created October 16, 2015 21:16
Show Gist options
  • Save montogeek/9ae7b966676a9d7ff283 to your computer and use it in GitHub Desktop.
Save montogeek/9ae7b966676a9d7ff283 to your computer and use it in GitHub Desktop.
var http = require('http');
var app = http.createServer(function(req,res){
res.setHeader('Content-Type', 'application/json');
res.setHeader('Content-Length', JSON.stringify(json).length);
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
res.setHeader('Access-Control-Allow-Methods', 'GET');
res.write(JSON.stringify(json));
res.end();
});
app.listen(4000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment