ursus
fun main() { embeddedServer(Netty, port = 8000) { routing { get ("/") { call.respondText("Hello, world!") } } }.start(wait = true) }
fun Route.root() { get ("/") { myLogic() call.respondText("Hello, world!") } } suspend fun myLogic() { ... }
fun Route.root(graph: DI) { get ("/") { val myService = graph.get<MyService>() myService.myLogic() call.respondText("Hello, world!") } } class MyService { suspend fun myLogic() { ... } }
Berkay Özkan
fun Application.main() { // Lazy inject HelloService val service by inject<UserService>() // Routing section routing { get("/hello") { call.respondText(service.sayHello()) } } }
A modern programming language that makes developers happier.