-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow client to control mapping between urls and files
For example: class WorkbenchRouting extends com.lihaoyi.workbench.Routing { def route(app: Directives) (implicit settings: RoutingSettings, resolver: ContentTypeResolver, refFactory: ActorRefFactory, log: LoggingContext): Route = { app.pathPrefix("css") { app.getFromDirectory(s"ui/target/web/sass/main/") } } } routing := new WorkbenchRouting,
- Loading branch information
Naksu
committed
Apr 4, 2016
1 parent
1c87140
commit 76a1017
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.lihaoyi.workbench | ||
|
||
import akka.actor.ActorRefFactory | ||
import spray.routing._ | ||
import spray.routing.directives.ContentTypeResolver | ||
import spray.util.LoggingContext | ||
|
||
trait Routing { | ||
def route(app: Directives) | ||
(implicit | ||
settings: RoutingSettings, | ||
resolver: ContentTypeResolver, | ||
refFactory: ActorRefFactory, | ||
log: LoggingContext): Route | ||
} | ||
|
||
object DefaultRouting extends Routing { | ||
def route(app: Directives) | ||
(implicit | ||
settings: RoutingSettings, | ||
resolver: ContentTypeResolver, | ||
refFactory: ActorRefFactory, | ||
log: LoggingContext): Route = { | ||
app.getFromDirectory(".") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters