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
2023-01-26 12:36:45 +01:00

12 lines
298 B
TypeScript

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);
}
};