I'm trying to serve angular2(rc3) app from akka-http(scala rest framework). It doesn't work because of routing. When requested, spray tries to find /my/endpoint/declared/in/angular
as normal resource. How should I do it?
With simple static webpages, without routing(dynamic links) it is pretty easy:
path("app") {
getFromResource("my-app/index.html")
} ~ getFromResourceDirectory("my-app")
I've tried to serve index.html every time when requested resource is not found:
path("app") {
getFromResource("my-app/index.html")
} ~ getFromResourceDirectory("my-app") ~ getFromResource("my-app/index.html")
but it breaks relative links( when I ask for /app/my/endpoint
I get index.html which tries to download styles.css from /app/my/endpoint/styles.css
instead of /app/styles.css
)
I would like to know how it is done in other http servers.