password 被查询出来了
来源:17-1 回顾与总结
香饽饽0
2019-07-08
async create(ctx) {
ctx.verifyParams({
name: { type: 'string', required: true },
password: { type: 'string', required: true },
});
const { name } = ctx.request.body;
const repeatedUser = await User.findOne({ name });
if (repeatedUser) { ctx.throw(409, '用户已经占用'); }
const user = await new User(ctx.request.body).save();
ctx.body = user;
}
这个接口最后的 user 老师你会有 password 字段吗?
我的会有 password 字段
(列表数据已确认没有 password)
写回答
1回答
-
可以详细比对一下课程实例代码。如果你不想返回password的话,可以自行把它删掉再返回。
032019-07-09
相似问题