exceptMany static method

Middleware exceptMany(
  1. List<String> paths,
  2. Middleware middleware
)

Wraps a middleware to execute for all paths EXCEPT those in the paths list.

Implementation

static Middleware exceptMany(List<String> paths, Middleware middleware) {
  return (ctx, next) async {
    if (paths.contains(ctx.request.uri.path)) {
      return await next();
    }
    return await middleware(ctx, next);
  };
}