Skip to content

Instantly share code, notes, and snippets.

@eivindingebrigtsen
Created October 5, 2011 07:37
Show Gist options
  • Save eivindingebrigtsen/1263866 to your computer and use it in GitHub Desktop.
Save eivindingebrigtsen/1263866 to your computer and use it in GitHub Desktop.
Express status code server
var app = require('express').createServer();
app.get('/status/201', function(req, res){res.send(201);}); // Created
app.get('/status/202', function(req, res){res.send(202);}); // Accepted
app.get('/status/204', function(req, res){res.send(204);}); // No Content
app.get('/status/206', function(req, res){res.send(206);}); // Partial content
app.get('/status/301', function(req, res){res.send(301);}); // Moved permanently
app.get('/status/400', function(req, res){res.send(400);}); // Bad request
app.get('/status/401', function(req, res){res.send(401);}); // Unauthorized
app.get('/status/403', function(req, res){res.send(403);}); // Forbidden
app.get('/status/404', function(req, res){res.send(404);}); // Not found
app.get('/status/405', function(req, res){res.send(405);}); // Method not allowed
app.get('/status/406', function(req, res){res.send(406);}); // Not acceptable
app.get('/status/410', function(req, res){res.send(410);}); // Gone
app.get('/status/413', function(req, res){res.send(413);}); // Request entity too large
app.get('/status/418', function(req, res){res.send(418);}); // I'm a teapot
app.get('/status/500', function(req, res){res.send(500);}); // Internal Server Day
app.get('/status/501', function(req, res){res.send(501);}); // Not implemented
app.get('/status/502', function(req, res){res.send(502);}); // Bad gateway
app.get('/status/503', function(req, res){res.send(503);}); // Service unavailable
app.get('/status/504', function(req, res){res.send(504);}); // Gateway timeout
app.get('/status/505', function(req, res){res.send(505);}); // HTTP version not supported
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment