app.post('/notes', function(req, res){
var options = body;
var _name = options.name;
var _age = options.age;
res.redirect('/page?name=_name&age=_age')
})
app.get('/page', function(req, res){
var options = req.query;
var name = options.name;
var age = options.age;
....
})
var idToUpdate = 1;
mongoModel.findOneAndUpdate({active: true}, {active: false}, function(err, result){
if(!err){
mongoModel.update({_id: idToUpdate }, {active: true}, function(err, result){
console.log('Updated')
})
}
})
var express = require('express');
var app = express();
var mw1 = function(req, res, next){
res.send('Hello')
next('mw2');
}
var mw2 = function(req, res){
res.send('world')
}
app.get('/', mw1, mw2);
app.listen(3030)