WebRouteBuilder

class WebRouteBuilder(val use: (WebMiddleware) -> Unit, val handle: (suspend WebContext.() -> Unit) -> Unit)

A builder for defining HTTP routes in the application, providing middleware support and a route handler.

Constructors

Link copied to clipboard
constructor(use: (WebMiddleware) -> Unit, handle: (suspend WebContext.() -> Unit) -> Unit)

Properties

Link copied to clipboard
val handle: (suspend WebContext.() -> Unit) -> Unit

A function that defines how to handle the route requests.

Link copied to clipboard

A function that adds middleware to the route.

Functions

Link copied to clipboard
fun handle(block: suspend WebContext.() -> Unit)

Defines the handler function for the route.

Link copied to clipboard
fun use(middleware: WebMiddleware)

Adds middleware to the route.

Link copied to clipboard
fun useNamed(name: String, middlewares: List<WebMiddleware>)

Adds middleware by name to the route.