-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage with koa #93
Comments
@saintedlama No response so far? ❓ |
Sorry, I've really not enough experience with koa to help you with the issue. |
There is an example with Promise: router.post('/register', async(ctx, next) => {
let user = new UserModel(ctx.request.body);
return await new Promise(function (resolve, reject) {
UserModel.register(user, ctx.request.body.password, (err, user) => {
if (err) {
reject(err);
}
ctx.state.user = user.toObject();
return resolve(next());
});
});
}); |
We've added complete, in-depth Koa (v2+) support using passport-local-mongoose. We wrote some extra glue to handle edge cases as well, and added an async register function. |
Hi,
I'm currently trying to use passport-local-mongoose with koa, but my code doesn't seem to work.
Any hint what I'm doing wrong? Or is koa just not (yet) supported?
Snippet. (registers a new user, when the Account is created successfully redirect to the index page, if not display error)
Thanks in advance.
(Code worked in express just fine)
The text was updated successfully, but these errors were encountered: