dev.pellet.server.routing.http.PelletHTTPRouter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pellet-server Show documentation
Show all versions of pellet-server Show documentation
An opinionated Kotlin web framework, with best-practices built-in
package dev.pellet.server.routing.http
import dev.pellet.server.codec.http.HTTPRequestMessage
class PelletHTTPRouter : HTTPRouting {
override val routes = mutableListOf()
override fun add(route: PelletHTTPRoute) {
routes.add(route)
}
override fun route(
message: HTTPRequestMessage
): PelletHTTPRoute? {
// todo: investigate if route matching can be better than O(n)
return routes.firstOrNull {
it.method == message.requestLine.method && message.requestLine.resourceUri == it.uri
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy