route

fun Route.route(path: Regex, build: Route.() -> Unit): Route

Builds a route to match the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

Example:

route(Regex("/(?<number>\\d+)")) {
get("/hello") {
val number = call.parameters["number"]
...
}
}

fun Route.route(path: Regex, method: HttpMethod, build: Route.() -> Unit): Route

Builds a route to match the specified HTTP method and regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

Example:

route(Regex("/(?<name>.+)/hello"), HttpMethod.Get) {
handle {
val name = call.parameters["name"]
...
}
}

fun Route.route(path: String, build: Route.() -> Unit): Route

Builds a route to match the specified path.

See also


fun Route.route(path: String, method: HttpMethod, build: Route.() -> Unit): Route

Builds a route to match the specified HTTP method and path.

See also