(Sails.js)
How to ignore the favicon browser request and get the id that I want?
router.js
'GET /:id': 'UrlController.findOne'
/**
* `UrlController.findOne()`
*/
findOne: function (req, res) {
var id = req.param('id');
console.log(id);
Url.findOne({where: {id: id}}).exec(function(err, url) {
return res.redirect(url.target);
})
},
I found a more elegant solution:
Change:
router.js
'GET /:id': 'UrlController.findOne'
To:
'GET /:id': {
controller: "UrlController",
action: "findOne",
skipAssets: true
},
Also thanks to all for guiding me towards the solution.