Showing
3 changed files
with
3 additions
and
2 deletions
... | @@ -28,6 +28,7 @@ mongoose | ... | @@ -28,6 +28,7 @@ mongoose |
28 | useNewUrlParser: true, | 28 | useNewUrlParser: true, |
29 | useFindAndModify: false, | 29 | useFindAndModify: false, |
30 | useUnifiedTopology: true, | 30 | useUnifiedTopology: true, |
31 | + useCreateIndex : true | ||
31 | }) | 32 | }) |
32 | .then(() => { | 33 | .then(() => { |
33 | console.log("Connected to MongoDB"); | 34 | console.log("Connected to MongoDB"); | ... | ... |
... | @@ -14,7 +14,7 @@ exports.register = async (ctx) => { | ... | @@ -14,7 +14,7 @@ exports.register = async (ctx) => { |
14 | password: Joi.string().required(), | 14 | password: Joi.string().required(), |
15 | }); | 15 | }); |
16 | 16 | ||
17 | - const result = Joi.validate(ctx.request.body, schema); | 17 | + const result = schema.validate(ctx.request.body); |
18 | if (result.error) { | 18 | if (result.error) { |
19 | ctx.status = 400; | 19 | ctx.status = 400; |
20 | ctx.body = result.error; | 20 | ctx.body = result.error; | ... | ... |
... | @@ -51,7 +51,7 @@ exports.setProfile = async (ctx) => { | ... | @@ -51,7 +51,7 @@ exports.setProfile = async (ctx) => { |
51 | }) | 51 | }) |
52 | .unknown(); | 52 | .unknown(); |
53 | console.log(ctx.request.body); | 53 | console.log(ctx.request.body); |
54 | - const result = Joi.validate(ctx.request.body, schema); | 54 | + const result = schema.validate(ctx.request.body); |
55 | if (result.error) { | 55 | if (result.error) { |
56 | ctx.status = 400; | 56 | ctx.status = 400; |
57 | ctx.body = result.error; | 57 | ctx.body = result.error; | ... | ... |
-
Please register or login to post a comment