Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bcrypt.hash(ctx.request.body.pass, 10).then(hash => {
- var userData = {
- email: ctx.request.body.email,
- username: ctx.request.body.username,
- name: ctx.request.body.name,
- lastname: ctx.request.body.lastname,
- pass: hash,
- }
- console.log("create user...");
- console.log(userData);
- ctx.mongo.collection("users").insert(userData).then(() => {
- ctx.body = JSON.stringify({
- success: "createdUser"
- });
- }).catch(err => {
- ctx.body = JSON.stringify({
- error: err,
- });
- });
- }).catch(err => {
- console.log(err);
- ctx.body = JSON.stringify({
- error: err,
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement