https://github.com/noel-archive/ktor-routing
๐ญ Extension to Ktorโs routing system to add object oriented routing and much more. ๐
https://github.com/noel-archive/ktor-routing
kotlin ktor ktor-routing ktor-server
Last synced: about 1 year ago
JSON representation
๐ญ Extension to Ktorโs routing system to add object oriented routing and much more. ๐
- Host: GitHub
- URL: https://github.com/noel-archive/ktor-routing
- Owner: noel-archive
- License: mit
- Archived: true
- Created: 2022-04-27T07:47:20.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-12T18:53:05.000Z (about 3 years ago)
- Last Synced: 2025-03-16T08:14:18.730Z (about 1 year ago)
- Topics: kotlin, ktor, ktor-routing, ktor-server
- Language: Kotlin
- Homepage: https://ktor.noelware.org
- Size: 1.73 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ๐ญ Ktor Routing Extensions
> *Extension to Ktorโs routing system to add object-oriented routing and much more. ๐*
## Why?
This extension library was created to reduce the amount of boilerplate to install routing to Noelware's products and services.
We use **Ktor** for our major platforms like [charted-server](https://github.com/charted-dev/charted) and much more.
## Example
```kotlin
@Serializable
class RequestBody(val id: Int, val email: String)
class MyEndpoint: AbstractEndpoint() {
init {
install(SomeRoutingPlugin) {
// type-safe config
}
}
@Get
suspend fun get(call: ApplicationCall) {
call.respond(HttpStatusCode.OK, "Hello, world!")
}
@Post
suspend fun post(call: ApplicationCall) {
val body by call.body()
call.respond(HttpStatusCode.OK, "Hello user with ID ${body.id} and email ${body.email}!")
}
}
suspend fun main(args: Array) {
val server = embeddedServer(Netty, port = 9090) {
module {
// We need this to be enabled. :(
routing {}
install(NoelKtorRouting) {
loader(ReflectionBasedLoader("org.noelware.ktor.tests"))
endpoints += MyEndpoint()
}
}
}
}
```
## License
**ktor-routing** is released under the **MIT License** with love (เนใปฯ-)๏ฝโฅโ by Noelware. ๐