Created
December 4, 2015 07:28
-
-
Save Suave/6958281166034a9033ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newShop = new Shop.model({ | |
"name": body.name, | |
"type": body.shop_type, | |
"context": body.context | |
}); | |
newShop.save() | |
.then(function(shop){ | |
return this.body = {retcode:0}; | |
}) | |
.catch(function(err){ | |
console.log("catch: " + err); | |
//next({retcode: 1, message: err.errors}); | |
res.send(400, err); | |
return this.body = {retcode: 1, message: err.errors}; | |
}); |
hustKiwi
commented
Dec 4, 2015
exports.create = function*(req, res, next){
var body = this.request.body;
var newShop = new Shop.model({
"name": body.name,
"type": body.shop_type,
"context": body.context
});
newShop.save()
.then(function(shop){
res.jsonp({retcode:0});
})
.catch(function(err){
console.log("catch: " + err);
//next({retcode: 1, message: err.errors});
res.send(400, err);
res.jsonp({retcode: 1, message: err.errors});
});
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment