Last active
November 30, 2019 09:16
-
-
Save toantran-ea/219e962bc15b9aa4ac71d36b7c271ba6 to your computer and use it in GitHub Desktop.
init application routing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.demo | |
/* ktlint-disable no-wildcard-imports */ | |
import io.ktor.application.Application | |
import io.ktor.application.call | |
import io.ktor.application.install | |
import io.ktor.features.CallLogging | |
import io.ktor.features.DefaultHeaders | |
import io.ktor.response.respond | |
import io.ktor.routing.get | |
import io.ktor.routing.post | |
import io.ktor.routing.routing | |
// Entry Point of the application as defined in resources/application.conf. | |
// @see https://ktor.io/servers/configuration.html#hocon-file | |
fun Application.main() { | |
install(DefaultHeaders) | |
install(CallLogging) | |
routing { | |
get("/") { | |
call.respond("Hello World 111 !!") | |
} | |
get("entries") { | |
call.respond("Hello World 222 !!") | |
} | |
post("entries") { | |
call.respond("Hello World 333 !!") | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment