Skip to content

Instantly share code, notes, and snippets.

@AJ92
Last active September 18, 2018 21:12
Show Gist options
  • Save AJ92/d3b777b1e1e96aa8717e770961fd6c57 to your computer and use it in GitHub Desktop.
Save AJ92/d3b777b1e1e96aa8717e770961fd6c57 to your computer and use it in GitHub Desktop.
//register.ts
export class Register {
validateEmail(email){
return false;
}
onPostCheckMail (req, res) {
if(this.validateEmail(req.body.email) === true){ //validateEmail is undefined
res.end("available");
return;
}
res.end("taken");
}
}
//index.ts
let register = new Register(db);
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(express.json());
app.post('/checkemailp', register.onPostCheckMail);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment