Forked from AJ92/gist:d3b777b1e1e96aa8717e770961fd6c57
Last active
September 18, 2018 21:21
-
-
Save jkantr/a4126216bbea75f39d7f86a8900a6666 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
// some helper fns.. maybe in a different file or not | |
function validateEmail(email){ | |
return false; | |
} | |
export default (db) => { | |
// define some route handlers | |
function onPostCheckMail (req, res) { | |
if(validateEmail(req.body.email) === true){ //validateEmail is undefined | |
res.end("available"); | |
return; | |
} | |
res.end("taken"); | |
} | |
// return them | |
return { onPostCheckMail } | |
} | |
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
//index.ts | |
import createRegister from './checkmail'; | |
const register = createRegister(db); | |
app.post('/checkemailp', register.onPostCheckMail); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment