https://kotlinlang.org logo
Title
m

Marc Knaup

10/18/2017, 11:12 PM
What is a context path? 😅
👍 1
t

tipsy

10/18/2017, 11:30 PM
it's like setting a new root if your have a service that is supposed to be availabe at
<http://example.com/service/:path|example.com/service/:path>
, you will have to declare all your routes as
/service/...
if you can set a context path, you can build your app as normal without having to take this into account
an example with some code: https://javalin.io/news/2017/10/16/javalin-0.5.3-released.html#context-paths (i made this poll to decide if i should include this feature in javalin)
s

s4nchez

10/19/2017, 8:07 AM
In http4k we call this "nestable routes" https://www.http4k.org/cookbook/nestable_routes/
m

Marc Knaup

10/19/2017, 2:56 PM
Thanks for the explanation, I remeb r now from long time ago. It's like nesting routes in ktor. Nice to have. But I never liked the big architecture of application servers relying on such paths for distinct applications. It's usually better to use micro services and a dedicated router, isn't it?
s

s4nchez

10/19/2017, 8:47 PM
It depends on your approach to microservices. If a single service provide multiple endpoints (e.g
/v1/x
,
/v1/y
,
/v2/x
) I'd probably prefer managing those on the app itself rather than using a router.
👍 1