docs: function addRouteFactory(router, method, end) {
    return (pattern, ...middlewares) => {
      if (typeof pattern === 'function') {
        middlewares = [pattern, ...middlewares];
        pattern = '/';
      }
  
      // create a route with multiple middlewares
      const route = compose(middlewares, { beforeRunMiddleware: (middleware, req, resp) => {
        const len = req.routePath ? req.routePath.length : 0;
        if (req.url.slice(0, len) !== req.routePath) return false;// url changed
        return true;
      } });
      route.method = method;
  
      const keys = [];
      const re = ptre(pattern, keys, { end, strict: false, sensitive: false });
      route.re = re;// used to test the remain of req.url
      route.keys = keys;
  
      router.routes.push(route);
  
      return router;
    };
  }