Guest User

Untitled

a guest
Jan 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. var getStructure = function(req, res, next) {
  2. db.findOne({name: req.params.name}, function(err, result) {
  3. res.json(result);
  4. });
  5. }
  6.  
  7. app.get('/structure/:name', getStructure);
  8.  
  9. app.post('/structure/:name/save', function(req, res, next) {
  10. var structure = req.body;
  11.  
  12. db.save(structure, function(err, result) {
  13. next();
  14. });
  15. }, getStructure);
Add Comment
Please, Sign In to add comment