I have the following express POST route handler that accepts GET and POST data something like this:
app.post('/handler/:id/:type', function (req, res, next) {
var id = req.param('id');
var type = req.param('type');
var body = req.body;
// Ho to check req.body params?
var document = _.extend(req.body, {id: id, type: type});
Collection.create(document, function (err, data) {
.....
})
});
Is it problem to don't check incoming parameters and write to MongoDB database as in example above? Or how can check this ones?