Registers middleware to parse path parameters.
14141
function registerPathParamMiddleware () {
    let pathParams = getAllPathParamNames();

    pathParams.forEach((param) => {
      if (!alreadyRegistered(param)) {
        router.param(param, pathParamMiddleware);
      }
    });
  }
441258
def _add_route(self, method, path, middleware=None):
        """"""
        if middleware is not None:
            self.add(method, path, middleware)
            return self
        else:
            # return a lambda that will return the 'func' argument
            return lambda func: (
                self.add(method, path, func),
                func
            )[1]
820060
function (method, endpoint, routerMiddelware) {
		var self = this;

		if (typeof routerMiddelware == 'object'){
			this.app[method](endpoint, function (req, res, next) {
				var middlewareFunction = []
				routerMiddelware.forEach(function (m) {
					middlewareFunction.push(function (cb) {
						self.__exec__middlewares(m, req, res, cb);
					});
				});

				async.waterfall(middlewareFunction);
			});
		} else {
			this.app[method](endpoint, function (req, res, next) {
				self.__exec__middleware(routerMiddelware)(req, res, next);
			});
		}
	}
1143684
function middlewares() {
        app.middlewares = {}
        const basePath = path.join(app.root, '/middlewares')
        let middlewares = app.config.get('express').middlewares
        if (middlewares && Array.isArray(middlewares) && middlewares.length) {
            for (let m of middlewares) {
                let middleware = require(path.join(basePath, m.dest))(app)
                app.middlewares[m.dest.toLowerCase()] = middleware

                if (middleware.length == 4) { //error handler
                    errorHandlers.push(middleware)
                    continue
                }

                if (m.src)
                    server.use(m.src, wrapper(middleware))
                else
                    server.use(wrapper(middleware))
            }
            if (middlewares.length)
                app.drivers.logger.success('Middleware', 'initialized')
        }
    }
118910
def validate_path_parameters(target_path, api_path, path_parameters, context):
    
    base_path = context.get('basePath', '')
    full_api_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + api_path)
    parameter_values = get_path_parameter_values(
        target_path, full_api_path, path_parameters, context,
    )
    validate_parameters(parameter_values, path_parameters, context=context)
946381
function RegisterEndpoint(method, path, _desc, _callback) {
    if(!_.isString(path)) {
      throw new Error("Invalid path for " + path + " (" + method + ")");
    }
    var desc = (typeof _desc === 'string' ? _desc : null),
      callback = (typeof _desc === 'function' ? _desc : (typeof _callback === 'function' ? _callback : null));
    var name = method + ":" + path.replace(/\//g, '.');
    if(name.charAt(0) === '.') name = name.substr(1);
    if(typeof this.__endpoints[name] !== 'undefined') {
      throw new Error("Previously registered endpoint " + path + " in namespace "+ this.__namespace + "(" + method + ")");
    }
    ENDPOINT_COUNTER++;
    var endpointChain = new RouteChain(name, path, method, SERVER);
    endpointChain.__namespace = this.__namespace;
    if(desc) endpointChain['desc'] = desc;
    if(callback) endpointChain.then(callback);
    this.__endpoints[name] = endpointChain;
    /* We allow route chaining of utility functions. After a route endpoint has been created,
     * we can attach additional data / utility functions to it. */
    return endpointChain;
  }
792434
public static function registerMiddleware() {
        $path = str_finish(str_replace([ "/"], [ "\\"], app_path('Http/Kernel.php')), '.php');
        $middlewareClass = "\\Sirgrimorum\\CrudGenerator\\Middleware\\CrudGeneratorLocaleRedirect";
        if (file_exists($path)) {
            $contents = file($path);
            $inicio = -1;
            $fin = -1;
            $encontrado = -1;
            foreach ($contents as $index => $line) {
                if (strpos($line, '$routeMiddleware = [') !== false) {
                    $inicio = $index;
                }
                if (strpos($line, $middlewareClass) !== false && $inicio >= 0 && $fin == -1) {
                    $encontrado = $index;
                }
                if (strpos($line, "];") !== false && $inicio >= 0 && $fin == -1) {
                    $fin = $index;
                }
            }
            $newTexto = chr(9) . "'crudgenlocalization' => " . $middlewareClass . "::class, " . chr(13) . chr(10);
            if ($encontrado >= 0) {
                $contents[$encontrado] = $newTexto;
            } elseif ($inicio >= 0 && $fin >= 0) {
                $newContent = array_slice($contents, 0, $fin);
                $newContent[] = $newTexto;
                foreach (array_slice($contents, $fin) as $linea) {
                    $newContent[] = $linea;
                }
                $contents = $newContent;
            }
            $contents = file_put_contents($path, $contents);
        } else {
            $contents = false;
        }
        return $contents;
    }
1275052
def _init_routes_and_middlewares(self):
        """"""
        self._init_middlewares()
        self._init_endpoints()

        self.app = falcon.API(middleware=self.middleware)
        self.app.add_error_handler(Exception, self._error_handler)

        for version_path, endpoints in self.catalog:
            for route, resource in endpoints:
                self.app.add_route(version_path + route, resource)
93570
def post(path, params={})
      signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params
      request(:post, path, params, signature_params)
    end
221299
protected function registerMiddleware() {
    $middleware = $this->app['config']['app.middleware'];

    foreach ($middleware as $class_name) {
      $filter = app($class_name);
      if ($filter instanceof BeforeInterface) {
        array_push($this->before, $filter);
      }
      if ($filter instanceof AfterInterface) {
        array_push($this->after, $filter);
      }
    }
  }
1239444
protected function registerMiddleware()
    {
        if ($this->isLumen()) {
            $this->app->routeMiddleware($this->middlewareAliases);
        } else {
            $this->aliasMiddleware();
        }
    }
1180747
def register_endpoint(self, path, app=None):
        

        if is_running_from_reloader() and not os.environ.get('DEBUG_METRICS'):
            return

        if app is None:
            app = self.app or current_app

        @app.route(path)
        @self.do_not_track()
        def prometheus_metrics():
            # import these here so they don't clash with our own multiprocess module
            from prometheus_client import multiprocess, CollectorRegistry

            if 'prometheus_multiproc_dir' in os.environ:
                registry = CollectorRegistry()
            else:
                registry = self.registry

            if 'name[]' in request.args:
                registry = registry.restricted_registry(request.args.getlist('name[]'))

            if 'prometheus_multiproc_dir' in os.environ:
                multiprocess.MultiProcessCollector(registry)

            headers = {'Content-Type': CONTENT_TYPE_LATEST}
            return generate_latest(registry), 200, headers
579192
def registerStatsHandler(app, serverName, prefix='/status/'):
  """"""
  if prefix[-1] != '/':
    prefix += '/'
  handler = functools.partial(statsHandler, serverName)
  app.add_url_rule(prefix, 'statsHandler', handler, methods=['GET'])
  app.add_url_rule(prefix + '<path:path>', 'statsHandler', handler, methods=['GET'])
949400
private function registerMapping()
    {
        /* @var \Swoft\Console\Router\HandlerMapping $route */
        $route = App::getBean('commandRoute');

        $commandMapping = CommandCollector::getCollector();
        $route->register($commandMapping);
    }
295036
public static function register($name, $path, $controller, $parameters, $options=array()) {
		static::$routes[$name] = new static($name, $path, $controller, $parameters, $options);
	}
195371
async def startup(self):
        
        if self.frozen:
            return False

        if self._error_handlers:
            self.middlewares.append(_exc_middleware_factory(self))

        # Register static paths
        for path in self.cfg.STATIC_FOLDERS:
            self.router.register_resource(SafeStaticResource(self.cfg.STATIC_PREFIX, path))

        await super(Application, self).startup()
1230841
protected function wrapMiddleware($path, $middleware)
    {
        return function(
            ServerRequestInterface $request,
            ResponseInterface $response,
            $next
        ) use ($middleware, $path) {
            $uriPath = $request->getUri()->getPath();

            if ($uriPath === $path || strpos($uriPath, rtrim($path, '/') . '/') === 0) {
                $ret = $middleware($request, $response, $next);
            } else {
                $ret = $next($request, $response);
            }
            
            return $ret;
        };
    }