Sebastien Leclerc Lavallee
03/29/2022, 10:08 PMfun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
fun Application.module() {
registerRoutes()
}
fun Application.registerRoutes() {
routing {
route("/") {
get {
call.respondText("Hello world!")
}
}
}
}
What would be the best way? Where should I put it?
Thanks!Aleksei Tirman [JB]
03/30/2022, 8:51 AMApplication.module
function. Here is an example:
fun Application.module() {
intercept(ApplicationCallPipeline.Setup) {
if (!call.request.headers.contains("my-header")) {
call.respond(HttpStatusCode.BadRequest)
}
}
// ...
}
Sebastien Leclerc Lavallee
03/31/2022, 1:13 PM