mirror of https://gitgud.io/fatchan/jschan.git
parent
54b5f4c9e1
commit
c0be2c0c9f
8 changed files with 58 additions and 17 deletions
@ -0,0 +1,24 @@ |
||||
'use strict'; |
||||
|
||||
module.exports = (req, res, next) => { |
||||
|
||||
//for body
|
||||
if (req.body.thread) { |
||||
req.body.thread = +req.body.thread; |
||||
} |
||||
if (req.body.checked) { |
||||
//syntax casts all string to number
|
||||
req.body.checked = req.body.checked.map(Number); |
||||
} |
||||
|
||||
//and for params
|
||||
if (req.params.id) { |
||||
req.params.id = +req.params.id; |
||||
} |
||||
if (req.params.page) { |
||||
req.params.page = +req.params.page; |
||||
} |
||||
|
||||
next(); |
||||
|
||||
} |
Loading…
Reference in new issue