1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/middleware/unless-middleware.ts

12 lines
298 B
TypeScript
Raw Normal View History

import { RequestHandler } from 'express';
export const unless =
(path: string, middleware: RequestHandler): RequestHandler =>
(req, res, next) => {
if (path === req.path) {
return next();
} else {
return middleware(req, res, next);
}
};