Skip to content

Instantly share code, notes, and snippets.

@reggi
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reggi/430d2c722dce31c033e1 to your computer and use it in GitHub Desktop.
Save reggi/430d2c722dce31c033e1 to your computer and use it in GitHub Desktop.
app.get("/api/loggedin.json", [
function(req, res, next) {
if (!req.user) return next(new Error("not logged in"));
return next();
},
function(req, res, next) {
return req.json({
"loggedin": true
});
},
function(err, req, res, next) {
return req.json({
"loggedin": false
});
},
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment