Last active
January 11, 2016 10:00
-
-
Save ahsankhatri/fb92c69139f9f503c679 to your computer and use it in GitHub Desktop.
HTTP Code status as a service
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
var http = require('http'); | |
http.createServer(function (request, response) { | |
var status = request.url.substr(1); | |
if ( ! http.STATUS_CODES[status]) { | |
status = '404'; | |
} | |
response.writeHead(status, { 'Content-Type': 'text/plain' }); | |
response.end(http.STATUS_CODES[status]); | |
}).listen(process.env.PORT || 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment