In order to serve static files from a jar, chances are you'll want to use the pathPrefix directive and not the path directive when using getFromResourceDirectory in spray-routing.
Here I've created a directory structure:
src/main/resources/admin ├── angular.js ├── camera.png └── index.html 0 directories, 3 files
Now I want all requests for "/admin" to be answered by the appropriate file resources in the "admin" subdirectory (or package) under resources:
⋮ path("admin") { compressResponse() { getFromResource("admin/index.html") } } ~ pathPrefix("admin") { compressResponse() { getFromResourceDirectory("admin") } } ~ ⋮
Note that spray-routing will not automatically attempt index.html or any other common index file when a request for a raw directory comes in; its very hands off in this sense. Requests for both admin and admin/ are matched and responded to with the admin/index.html resource.