https://kotlinlang.org logo
Title
k

kshvkantg

04/28/2023, 11:31 AM
Hi , I need some help with the initial ktor setup, I created a project from Intellij templates which gave me an initial application code:
fun main() {
    embeddedServer(Netty, port = 8080, host = "127.0.0.1", module = Application::module)
        .start(wait = true)
}

fun Application.module() {
    configureSecurity()
    configureHTTP()
    configureMonitoring()
    configureSerialization()
    configureDatabases()
    configureRouting()
}
and running staus is [DefaultDispatcher-worker-1] INFO ktor.application - Responding at http://127.0.0.1:8080, same when host is "0.0.0.0" but when i redirect to http://127.0.0.1:8080 on my browser. I get an error stating "Safari cannot open the page". how can I fix this?
a

Arun M

04/30/2023, 10:10 AM
Hope you are not running on VM or Docker? try host="0.0.0.0" and try with http://localhost and your machine IP (you can find using ipconfig/ifconfig). If it doesn't work, if the port is accessible via telnet.
telnet localhost(and your private IP as well) 8080
If you can not connect, check proxy and firewall