Alexandre Brown
12/12/2020, 10:30 PMpackage com.mdServerless.kotless
import io.kotless.dsl.ktor.Kotless
import io.ktor.application.*
import io.ktor.response.*
import io.ktor.routing.*
import kotlin.random.Random
class Server : Kotless() {
override fun prepare(app: Application) {
app.routing {
get("/") {
call.respondText { "Welcome to Kotless" }
}
get("/hello") {
val result = compute()
call.respondText { "Kotless says hello from Ktor! unique value: $result" }
}
post("/") {
call.respondText { "Your post was well received!" }
}
}
}
private fun compute(): Int {
return Random.nextInt()
}
}
Am I doing something wrong?TanVD
12/13/2020, 3:19 PMAlexandre Brown
12/13/2020, 3:55 PMTanVD
12/13/2020, 5:55 PMasarazan
12/14/2020, 5:13 PM