Skip to content

Instantly share code, notes, and snippets.

@ayxos
Last active August 29, 2015 13:56
Show Gist options
  • Save ayxos/8813241 to your computer and use it in GitHub Desktop.
Save ayxos/8813241 to your computer and use it in GitHub Desktop.
POST
exports.postnew = function (req, res){
var entry;
console.log("POST: " + req.params + req.body + req.query);
entry = new regModel();
for (key in req.body){
entry[key] = req.body[key];
}
entry.save(function (err) {
if (!err) {
console.log("created");
res.send(220,entry);
} else {
console.log(err);
res.send(500,'POST error');
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment