I have a middleware that sends out a confirmation email for user to activate their account. I want to reuse this middleware whenever the user change their email. Is there a way to call this middleware from another middleware?Example// modules/user.js app.post('/api/user/email/change', (req, resp) => { // check for user session // change email in database // call middleware below to send out confirmation email }); // index.js app.post('/api/send-confirmation', (req, resp) => { // send email });
Submitted March 03, 2019 at 04:50AM by eggtart_prince
No comments:
Post a Comment