mirror of
https://github.com/yusufipk/RememberMe.git
synced 2026-09-11 19:06:06 +00:00
create(middleware) validateobjectid middleware has been added
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
module.exports = function (req, res, next) {
|
||||
if (!mongoose.Types.ObjectId.isValid(req.params.id))
|
||||
return res.status(404).send("Invalid ID");
|
||||
next();
|
||||
};
|
||||
Reference in New Issue
Block a user