middleware for content-type validation, refactoring

This commit is contained in:
AlecM33
2022-07-05 19:17:36 -04:00
parent 4c94fb98df
commit de3a2b64cb
9 changed files with 29 additions and 33 deletions

View File

@@ -28,6 +28,16 @@ router.options('/:code/players', cors(globals.CORS));
router.options('/create', cors(globals.CORS));
router.options('/restart', cors(globals.CORS));
router.post('/create', (req, res, next) => {
globals.CONTENT_TYPE_VALIDATOR(req, res, next);
});
router.patch('/players', (req, res, next) => {
globals.CONTENT_TYPE_VALIDATOR(req, res, next);
});
router.patch('/restart', (req, res, next) => {
globals.CONTENT_TYPE_VALIDATOR(req, res, next);
});
if (process.env.NODE_ENV.trim() === 'production') {
router.use(apiLimiter);
router.use('/create', gameEndpointLimiter);