Last active
August 29, 2015 13:55
-
-
Save vdel26/8691923 to your computer and use it in GitHub Desktop.
simple node.js debugging server
This file contains 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
/* | |
* dummy API that returns the endpoint that was called | |
* and the apikey in JSON format | |
*/ | |
var http = require('http'); | |
var server = http.createServer(function (req, res) { | |
var responseContent = {}; | |
res.writeHead(200, {'Content-type': 'application/json'}); | |
// send back endpoint, apikey and headers | |
responseContent.endpoint = req.url.split('?')[0]; | |
// responseContent.apikey = req.url.split('?user_key=')[1]; | |
responseContent.headers = req.headers; | |
res.end(JSON.stringify(responseContent, null, '\t')); | |
}); | |
server.listen(8000, '0.0.0.0'); | |
console.log('server running at localhost:8000'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment