-
-
Save OscarGodson/96a4dc690a635816eb34 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
app = koa(); | |
app.use(route.post('/sendmail', sendMail)); | |
function *sendMail(email) { | |
var body = yield parse.form(this); | |
signup.save(body.email, function (res) { | |
this.body = res; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from #koajs
I am still learning myself,so take it with a grain of salt. Your signup.save needs to return a promise. You can change it, or use Q.denodeify. Then it gets easy: