shelf icon indicating copy to clipboard operation
shelf copied to clipboard

add a method to group routes and apply specific middleware to this group

Open insinfo opened this issue 1 year ago • 3 comments

add a method to group routes and apply specific middleware to this group

  app.chain([simulatedMiddleware]).group('/api/v1', (router) {
      for (final sr in simulatedRoutes) {
        final method = sr.keys.first.toUpperCase();
        final path = sr.values.first;
        router.addRoute(method, path, (req, res) => simulatedWork);
      }
    });

insinfo avatar Nov 12 '23 02:11 insinfo