https://kotlinlang.org logo
Title
m

Mustafa Ozhan

07/20/2021, 10:26 AM
Guys I have moved my backend to KMP, it is uses ktor with SQLDeleight When I run it on local with
./gradlew :backend:run
everything works as expected I can reach it by
<http://127.0.0.1:8080/endpoint>
it reposes. I have created a fat jar and run in my server but I can not get response when i
<http://IP_ADRESS:8080/endpoint>
the main is below
// Configs
private const val PORT = 8080
private const val HOST = "127.0.0.1"

fun main() {
....
    embeddedServer(
        Netty,
        port = PORT,
        host = HOST
    ) {

        routing {
         ....
        }
    }.start(wait = true)
}
What can be the reason, I have allowed my port also
c

crummy

07/20/2021, 10:29 AM
not very familiar with ktor but it looks like you're only listening on 127.0.0.1
m

Mustafa Ozhan

07/20/2021, 10:51 AM
shouldn’t be the right case for server ? I was doing same for my Kotlin Springboot app on server
h

hfhbd

07/20/2021, 10:53 AM
You should use the default ip, which is 0.0.0.0. Especially with docker, 127.0.0.1 does not work
m

Mustafa Ozhan

07/20/2021, 10:54 AM
ohh let me try with 0.0.0.0 too
🔥 Thanks a lot! That’s working