This here is a controller. In fact, this whole file is nothing more than a controller + renderer & doesn't need to be a router
771569
function getPostData(req, res, next) {
    req.body = req.body || {};

    const urlWithoutSubdirectoryWithoutAmp = res.locals.relativeUrl.match(/(.*?\/)amp\/?$/)[1];

    /**
     * @NOTE
     *
     * We have to figure out the target permalink, otherwise it would be possible to serve a post
     * which lives in two collections.
     *
     * @TODO:
     *
     * This is not optimal and caused by the fact how apps currently work. But apps weren't designed
     * for dynamic routing.
     *
     * I think if the responsible, target router would first take care fetching/determining the post, the
     * request could then be forwarded to this app. Then we don't have to:
     *
     * 1. care about fetching the post
     * 2. care about if the post can be served
     * 3. then this app would act like an extension
     *
     * The challenge is to design different types of apps e.g. extensions of routers, standalone pages etc.
     */
    const permalinks = urlService.getPermalinkByUrl(urlWithoutSubdirectoryWithoutAmp, {withUrlOptions: true});

    if (!permalinks) {
        return next(new common.errors.NotFoundError({
            message: common.i18n.t('errors.errors.pageNotFound')
        }));
    }

    // @NOTE: amp is not supported for static pages
    // @TODO: https://github.com/TryGhost/Ghost/issues/10548
    helpers.entryLookup(urlWithoutSubdirectoryWithoutAmp, {permalinks, query: {controller: 'postsPublic', resource: 'posts'}}, res.locals)
        .then((result) => {
            if (result && result.entry) {
                req.body.post = result.entry;
            }

            next();
        })
        .catch(next);
}
176638
def load_controllers
      return unless File.directory?(controllers_path)

      path = File.realpath(controllers_path)
      $LOAD_PATH.unshift(path)
      Dir["#{path}/**/*.rb"].each do |f|
        next if f.include?('_pb') # exclude if people include proto generated files in app/rpc

        logger.info "- Loading gRPC service file: #{f}"
        load File.realpath(f)
      end
    end
756673
function(req, res, router, cb) {
  var url = (req.url === '/') ? '/' + router.defaultPage : req.url;
  var source = router.static.path + url; //path.resolve(router.static.path, '.'+url);
  if (url.indexOf('.') != -1) {
    router.stat(source, function(err, stat) {
      if (err || stat === undefined || stat.size === undefined) {
        cb();
      } else {
        res.writeHead(200, {
          'Content-Type': router.getMime(url),
          'Content-Length': stat.size
        });
        router.openStream(source).pipe(res);
      }
    });
  } else {
    cb();
  }
}
1152297
@Override
    public synchronized Renderable<?> render(Controller controller, Map<String, Object> variables) {
        HashMap<String, Object> map = new HashMap<>(variables);
        if (!map.containsKey(ExtendedOGNLExpressionEvaluator.BUNDLE_VAR_KEY)) {
            map.put(ExtendedOGNLExpressionEvaluator.BUNDLE_VAR_KEY, bundle);
        }
        return templateEngine.process(this, controller, router, assets, map);
    }
246539
private static function router()
    {
        $files = ['Url'];
        $folder = static::$root.'Router'.'/';

        self::call($files, $folder);

        //New router surface

        $files = ['Route', 'Routes'];
        $folder = static::$root.'Http/Router'.'/';

        self::call($files, $folder);

        $files = ['RouteDuplicatedException', 'RouteMiddlewareNotFoundException', 'RouteNotFoundInRoutesRegisterException', 'NotFoundHttpException'];
        $folder = static::$root.'Http/Router/Exceptions'.'/';

        self::call($files, $folder);
    }
1186592
function () {

				this.router = this.getRouter();
				this.router.getRoute("entity").attachPatternMatched(this.onRouteMatched, this);

				this._oObjectPage = this.byId("ObjectPageLayout");

				this.getView().setModel(new JSONModel());
			}
319190
@Override
    public Renderable<?> render(Controller controller) {
        return render(controller, Collections.<String, Object>emptyMap());
    }
634723
function Router () {
    EventEmitter.apply(this);   // Call EventEmitter constructor

    this.routes = [];           // Array containing all routes
    this.path = '/';            // Current path (`/` is default)
    this.otherwise(this.path);  // Set default redirect
    this.cancel = false;        // Cancel next route change
    this.redirect = null;       // Redirect next route change

    this.recentReloads = 0;     // Number of reloads called in last 500ms
    this.resetTimer = null;     // Timeout set to clear recent reloads

    this.html5(false);          // Disable HTML5 mode by default
}
1281967
function Router_process(method, parsedUrl, headers) {

        return this.parseRequest(method, parsedUrl, headers)
            .then(function (routeRule) {
                if (Type.isArray(routeRule) && routeRule.length === 2) {
                    return Promise.resolve(routeRule);
                }
                // only on not found throw an error 404
                throw new error.HttpError(404, core.toObject(routeRule), 'Not found');
            }, function (e) {
                throw new error.HttpError(500, {}, 'Not found', e);
            });
    }
990275
function(){
    // set up router
    router.route(/^\/(active|completed)$/).param(0).as(function(subset){
      Todo.selected.set(Todo[subset || 'all']);
    });

    // return app root node
    return new Node({
      template: resource('./app/template/layout.tmpl'),
      binding: {
        // nested views
        form: resource('./module/form/index.js'),
        list: resource('./module/list/index.js'),
        stat: resource('./module/stat/index.js')
      }
    });
  }
552105
function () {
                    var content = ctrl.view;
                    var header  = noHeader ? null : new Jackbone.DefaultHeader();
                    var footer  = noFooter ? null : new Jackbone.DefaultFooter();
                    var view    = new JQMView(header, content, footer);

                    // Cache the controller
                    that.controllers[pageUID] = { pageUID: pageUID, controller: ctrl };
                    ctrl._rootView = view;
                    view.controller = ctrl;

                    doneCreate();
                }
58205
function withRouter(Component) {
  const displayName = `withRouter(${Component.displayName || Component.name})`;
  const C = props => {
    const { wrappedComponentRef, ...remainingProps } = props;

    return (
      <RouterContext.Consumer>
        {context => {
          invariant(
            context,
            `You should not use <${displayName} /> outside a <Router>`
          );
          return (
            <Component
              {...remainingProps}
              {...context}
              ref={wrappedComponentRef}
            />
          );
        }}
      </RouterContext.Consumer>
    );
  };

  C.displayName = displayName;
  C.WrappedComponent = Component;

  if (__DEV__) {
    C.propTypes = {
      wrappedComponentRef: PropTypes.func
    };
  }

  return hoistStatics(C, Component);
}
1152412
protected RenderBuilder render(){

        String template = Router.getControllerPath(getClass()) + "/" + RequestContext.getRoute().getActionName();
        return super.render(template, values());
    }
884006
function Router(req, res, next) {
        const server = this;
        const state = {
            method: req.method.toUpperCase(),
            params: {},
            routes: routes.concat(),
            routeUnhandled: true,
            server: server,
        };
        run(state, req, res, err => {
            req.params = {};
            if (state.routeUnhandled) req.log('unhandled', 'Router had no matching paths');
            next(err);
        });
    }
965661
def make_router(self, rule, method=None, handler=None, cls=None,
                    name=None, **params):
        '''
        '''
        cls = cls or Router
        router = cls(rule, name=name, **params)
        for r in self.routes:
            if r._route == router._route:
                if isinstance(r, cls):
                    router = r
                    router._set_params(params)
                    break
        if method and handler:
            if isinstance(method, tuple):
                for m in method:
                    setattr(router, m, handler)
            else:
                setattr(router, method, handler)
        return router
998023
def renderer_options
      options = {
        # script_name: "", # unfortunately doesnt seem to effect relative_url_root like desired
        # input: ""
      }

      origin = headers["origin"]
      if origin
        uri = URI.parse(origin)
        options[:https] = uri.scheme == "https"
      end

      # Important to not use rack_headers as local variable instead of headers.
      # headers is a method that gets deleted to controller.headers and using it
      # seems to cause issues.
      rack_headers = rackify_headers(headers)
      options.merge!(rack_headers)

      # Note @options[:method] uses @options vs options on purpose
      @options[:method] = event["httpMethod"].downcase if event["httpMethod"]
      options
    end
1215452
def save
      buffer = render

      File.open(path, 'wb') { |f| f.write(buffer.string) }
    end