extracted server id validation

This commit is contained in:
Danny Coates
2018-02-05 16:36:44 -08:00
parent 807c44f057
commit aae61f9451
15 changed files with 83 additions and 388 deletions
+12
View File
@@ -0,0 +1,12 @@
function validateID(route_id) {
return route_id.match(/^[0-9a-fA-F]{10}$/) !== null;
}
module.exports = {
middleware: function(req, res, next) {
if (req.params.id && !validateID(req.params.id)) {
return res.sendStatus(404);
}
next();
}
};