我在这里遵循本教程:
我遇到了User.create(...);
代码行没有返回的问题,因此我的POSTMAN测试超时了。
我认为导致此问题的代码块是:
signup: function(req, res) {
console.log('\n\nCreating a new user...');
User
.create(_.omit(req.allParams(), 'id'))
.then(function (user) {
console.log('\n\nreturning newly created user...');
return {
// TODO: replace with new type of cipher service
token: CipherService.createToken(user),
user: user
};
})
.then(res.created)
.catch(res.serverError);
},
我看到第一个控制台输出:
info: Starting app...
info:
info: .-..-.
info:
info: Sails <| .-..-.
info: v0.11.0 |\
info: /|.\
info: / || \
info: ,' |' \
info: .-'.-==|/_--'
info: `--'-------'
info: __---___--___---___--___---___--___
info: ____---___--___---___--___---___--___-__
info:
info: Server lifted in `/Users/MacUser/SailsProjects/myApi`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.
debug: --------------------------------------------------------
debug: :: Sat Sep 12 2015 15:41:21 GMT+0800 (AWST)
debug: Environment : development
debug: Port : 1337
debug: --------------------------------------------------------
Creating a new user...
但是我没有看到第二个控制台输出= /
任何人都知道我做错了什么?
答案 0 :(得分:0)
好吧,我的不好......似乎我在按照上面的教程时错过了一条线。
我在我的wtfismyip.com. 3600 IN AAAA 2604:4300:a:2c::1:1
wtfismyip.com. 3600 IN A 69.30.217.90
模型类中有这个:
User.js
应该是:
beforeCreate: function(values, next) {
CipherService.hashPassword(values);
}