Funny that I have to start a whole application for this though, on one hand it's more flexible, but it means re-installing all the same features for both, etc... it might have been nice to have
fun main(args: Array<String>) {
embeddedServer(Netty, port = 8080, module = Application::apiModule).start(wait = false)
embeddedServer(Netty, port = 9090, module = Application::internalModule).start(wait = true)
}
fun Application.apiModule() {
common()
routing {
// specific for the api
}
}
fun Application.internalModule() {
common()
routing {
// specific for internal
}
}
fun Application.common() {
routing {
// for both services
}
}
d
dave08
04/19/2018, 1:29 PM
That's what I thought, but one Netty instance can't listen on two ports and redirect accordingly, in Vert.x I don't think I had to start a webserver for each port...
But then, I don't know that much about Netty internals (I'm coming from Php/nginx...)
c
cy
04/19/2018, 2:34 PM
Note that you can check incoming port via
call.request.local.port
(for example, you can install an interceptor on specific route to ensure that the port is right)