<commit_before>open class Routes {
    public let staticFilesPath: String
    public var routes: [Route] = []

    public lazy var fallback: Responder = FileResponder(path: self.staticFilesPath)

    public init(staticFilesPath: String) {
        self.staticFilesPath = staticFilesPath
    }
}

extension Routes {
    public func compose(_ path: String, middleware: [Middleware] = [], router representable: RouterRepresentable) {
        let router = representable.router
        for route in router.routes {
            for (method, responder) in route.actions {
                add(method: method, path: path + route.path, middleware: middleware, responder: responder)
            }
        }
    }
}

extension Routes {
    public func fallback(middleware: [Middleware] = [], respond: @escaping Respond) {
        fallback(middleware: middleware, responder: BasicResponder(respond))
    }

    public func fallback(middleware: [Middleware] = [], responder: Responder) {
        fallback = middleware.chain(to: responder)
    }
}

extension Routes {
    public func get(
        _ path: String = "",<commit_msg>Fix a bug where router-specific middleware is ignored during composition<commit_after>open class Routes {
    public let staticFilesPath: String
    public var routes: [Route] = []

    public lazy var fallback: Responder = FileResponder(path: self.staticFilesPath)

    public init(staticFilesPath: String) {
        self.staticFilesPath = staticFilesPath
    }
}

extension Routes {
    public func compose(_ path: String, middleware: [Middleware] = [], router representable: RouterRepresentable) {
        let router = representable.router
        let middleware = middleware + router.middleware
        for route in router.routes {
            for (method, responder) in route.actions {
                add(method: method, path: path + route.path, middleware: middleware, responder: responder)
            }
        }
    }
}

extension Routes {
    public func fallback(middleware: [Middleware] = [], respond: @escaping Respond) {
        fallback(middleware: middleware, responder: BasicResponder(respond))
    }

    public func fallback(middleware: [Middleware] = [], responder: Responder) {
        fallback = middleware.chain(to: responder)
    }
}

extension Routes {
    public func get(
        _ path: String = "",
{'fraction_non_alphanumeric': 0.09483126868859462, 'fraction_numerical': 0.0, 'mean_word_length': 3.0519031141868513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3614584', 'n_tokens_mistral': 656, 'n_tokens_neox': 639, 'n_words': 183}