Skip to main content
added missing closing quote
Source Link
Tom Howard
  • 6.7k
  • 38
  • 59

Maybe this will be of any help to those who read this, but I like to use arrow functions to keep my code clean. Since all I do is change one variable it should only take one line of code:

module.exports = function(repo){
    
  router.route('/:idid',
  (req, res, next) => { req.params.id = parseInt(req.params.id); next(); })
    .get(repo.getById)
    .delete(repo.deleteById)
    .put(repo.updateById);
}

Maybe this will be of any help to those who read this, but I like to use arrow functions to keep my code clean. Since all I do is change one variable it should only take one line of code:

module.exports = function(repo){
    
  router.route('/:id,
  (req, res, next) => { req.params.id = parseInt(req.params.id); next(); })
    .get(repo.getById)
    .delete(repo.deleteById)
    .put(repo.updateById);
}

Maybe this will be of any help to those who read this, but I like to use arrow functions to keep my code clean. Since all I do is change one variable it should only take one line of code:

module.exports = function(repo){
    
  router.route('/:id',
  (req, res, next) => { req.params.id = parseInt(req.params.id); next(); })
    .get(repo.getById)
    .delete(repo.deleteById)
    .put(repo.updateById);
}
Source Link

Maybe this will be of any help to those who read this, but I like to use arrow functions to keep my code clean. Since all I do is change one variable it should only take one line of code:

module.exports = function(repo){
    
  router.route('/:id,
  (req, res, next) => { req.params.id = parseInt(req.params.id); next(); })
    .get(repo.getById)
    .delete(repo.deleteById)
    .put(repo.updateById);
}