Skip to content

Instantly share code, notes, and snippets.

@dpogorzelski
Created March 6, 2014 12:45
Show Gist options
  • Save dpogorzelski/9388784 to your computer and use it in GitHub Desktop.
Save dpogorzelski/9388784 to your computer and use it in GitHub Desktop.
app.post('/api/foo', function (req, res) {
res.send(200);
});
app.post('/api/bar', function (req, res) {
res.send(200);
});
app.use(function (err, req, res, next) {
if (err.constructor.name === 'UnauthorizedError') {
res.send(401, 'Unauthorized');
} else {
res.send(500);
}
});
app.get('*', function (req, res) {
res.render('index');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment