Last active
August 2, 2022 09:31
-
-
Save adityawibisana/e7a507a7006eafaff6618b843a350ee1 to your computer and use it in GitHub Desktop.
Sails Medium RequiredParam https://medium.com/p/368d1713a82f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (params) => { | |
return (req, res, next) => { | |
if (params === "username" && !req.param("username")) { | |
return res.status(400).send({ | |
code: 1, | |
message: `'username' parameter is needed` | |
}) | |
} | |
return next() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment