Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var getStructure = function(req, res, next) {
- db.findOne({name: req.params.name}, function(err, result) {
- res.json(result);
- });
- }
- app.get('/structure/:name', getStructure);
- app.post('/structure/:name/save', function(req, res, next) {
- var structure = req.body;
- db.save(structure, function(err, result) {
- next();
- });
- }, getStructure);
Add Comment
Please, Sign In to add comment