Created
August 18, 2016 15:33
-
-
Save hnry/2031dedf2b3121eb398df882ff7d0609 to your computer and use it in GitHub Desktop.
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
const {response} = require("spirit").node | |
(handler) => { | |
return async (request) => { | |
const userExists = await calltoDB(request.user) | |
if (!userExists) return response("you have to login!") | |
return handler(request) | |
} | |
} | |
// manual way, mostly equivalent to the above without using response() | |
(handler) => { | |
return async (request) => { | |
const userExists = await calltoDB(request.user) | |
if (!userExists) return { status: 200, headers: {}, body: "you have to login!" } | |
return handler(request) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment