Routing
A root routing node of an Application. You can learn more about routing in Ktor from Routing.
Parameters
is an instance of Application for this routing node.
Types
An installation object of the Routing plugin.
Properties
Gets an Application for this RouteNode by scanning the hierarchy to the root.
Pipeline for receiving content
Pipeline for sending content
Base package for relative resources calculations for static content
Base folder for relative files calculations for static content
Functions
Builds a route to match requests with the HttpHeaders.Accept header matching any of the specified contentTypes.
Builds a route to match requests with the HttpHeaders.ContentType header matching the specified contentType.
Creates a child node in this node with a given selector or returns an existing one with the same selector.
Creates a routing entry for the specified path.
Specifies resource as a default resources to serve when folder is requested
Builds a route to match DELETE
requests.
Builds a route to match DELETE
requests with the specified path.
Builds a route to match DELETE
requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Builds a route to match GET
requests.
Builds a route to match GET
requests with the specified path.
Builds a route to match GET
requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Return list of endpoints with handlers under this route.
Installs a handler into this route which is called when the route is selected for a call.
Builds a route to match HEAD
requests.
Builds a route to match HEAD
requests with the specified path.
Builds a route to match HEAD
requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Creates a route to match a request's host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.
Creates a route to match a request host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.
Creates a route to match s request host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.
Builds a route to match OPTIONS
requests.
Builds a route to match OPTIONS
requests with the specified path.
Builds a route to match OPTIONS
requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Builds a route to match PATCH
requests.
Builds a route to match PATCH
requests receiving a request body as content of the R type.
Builds a route to match PATCH
requests with the specified path.
Builds a route to match PATCH
requests with the specified path receiving a request body as content of the R type.
Builds a route to match PATCH
requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Builds a route to match PATCH
requests with the specified regex path receiving a request body as content of the R type. Named parameters from regex can be accessed via ApplicationCall.parameters.
Builds a route to match POST
requests.
Builds a route to match POST
requests receiving a request body as content of the R type.
Builds a route to match POST
requests with the specified path.
Builds a route to match POST
requests with the specified path receiving a request body as content of the R type.
Builds a route to match POST
requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Builds a route to match POST
requests with the specified regex path receiving a request body as content of the R type. Named parameters from regex can be accessed via ApplicationCall.parameters.
Support pre-compressed files and resources
Builds a route to match PUT
requests.
Builds a route to match PUT
requests receiving a request body as content of the R type.
Builds a route to match PUT
requests with the specified path.
Builds a route to match PUT
requests with the specified path receiving a request body as content of the R type.
Builds a route to match PUT
requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Builds a route to match PUT
requests with the specified regex path receiving a request body as content of the R type. Named parameters from regex can be accessed via ApplicationCall.parameters.
Sets up routing to serve resource as remotePath in resourcePackage
Sets up routing to serve all resources in resourcePackage
Builds a route to match the specified path.
Builds a route to match the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Builds a route to match the specified HTTP method and regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.
Serves a single-page application. You can learn more from Serving single-page applications.
Sets up Routing to serve static files. All files inside dir will be accessible recursively at "remotePath/path/to/file". If the requested file is a directory and index is not null
, then response will be index file in the requested directory.
Sets up Routing to serve fileSystem as static content. All paths inside basePath will be accessible recursively at "remotePath/path/to/resource". If requested path doesn't exist and index is not null
, then response will be index path in the requested package.
Sets up Routing to serve resources as static content. All resources inside basePackage will be accessible recursively at "remotePath/path/to/resource". If requested resource doesn't exist and index is not null
, then response will be index resource in the requested package.
Registers a function used to trace route resolution. Might be useful if you need to understand why a route isn't executed. To learn more, see Tracing routes.