https://kotlinlang.org logo
#ktor
Title
# ktor
f

Felistas Ngumi

02/04/2020, 10:39 AM
Hi, I'm new to Kotlin and Ktor and i'd like this basic function to run but I can't find where the issue is:
Copy code
package com.example

import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty
import io.ktor.routing.*

fun main() {
    embeddedServer(Netty, port = 8080){ }.start()
    routing {
        get("/") {
            call.respondText("Hello, world!", ContentType.Text.Html)
        }
    }
}
The issue i'm getting is, the routing package cannot be imported. Any assistance will be greatly appreciated.
m

Matteo Mirk

02/04/2020, 11:02 AM
take a look at quick guides on ktor site: https://ktor.io/quickstart/guides/application.html You cannot configure routing over… no object like you do 🙂 it has to be on an application module
f

Felistas Ngumi

02/04/2020, 11:23 AM
thank you @Matteo Mirk. my routing function should have been inside the embedded server function
👍 1