Skip to content

Instantly share code, notes, and snippets.

@jkantr
Forked from AJ92/gist:d3b777b1e1e96aa8717e770961fd6c57
Last active September 18, 2018 21:21
Show Gist options
  • Save jkantr/a4126216bbea75f39d7f86a8900a6666 to your computer and use it in GitHub Desktop.
Save jkantr/a4126216bbea75f39d7f86a8900a6666 to your computer and use it in GitHub Desktop.
// 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 }
}
//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