by volgar1x · 6y ago · 0 comments
router.get("/api/article/:id").coroutineHandler { ctx ->
val news = newsRepository.get(ctx.pathParam("id")) // no need for await
?: return ctx.respondText(404, "Not Found") // can still use basic code constructs
ctx.respondJson(200, jsonObjectOf("news" to news)) // actually an extension method i wrote
}No comments yet.