UNPKG

forest-express

Version:

Official package for all Forest Express Lianas

18 lines (17 loc) 497 B
"use strict"; var deactivateCountMiddleware = function deactivateCountMiddleware(request, response) { var path = request.path; var splittedPath = path.split('/'); if (splittedPath[splittedPath.length - 1] === 'count') { response.status(200).send({ meta: { count: 'deactivated' } }); } else { response.status(400).send({ error: 'The deactiveCount middleware can only be used in count routes.' }); } }; module.exports = deactivateCountMiddleware;