Created
May 13, 2014 03:16
-
-
Save danellis/1cf8623b0631eff738c9 to your computer and use it in GitHub Desktop.
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
val myRoute = | |
pathPrefix("rest") { | |
controller("apps", RestController(AppDao)) ~ | |
controller("clusters", RestController(ClusterDao)) ~ | |
controller("commits", RestController(CommitDao)) ~ | |
controller("deployments", RestController(DeploymentDao)) ~ | |
controller("config-keys", RestController(ConfigKeyDao)) ~ | |
controller("config-values", RestController(ConfigValueDao)) ~ | |
controller("blades", RestController(BladeDao)) ~ | |
controller("stacks", RestController(StackDao)) ~ | |
controller("repositories", RestController(RepositoryDao)) ~ | |
controller("process-types", RestController(ProcessTypeDao)) ~ | |
controller("search", context.actorOf(Props[SearchController])) | |
} ~ | |
path("events") { | |
get { ctx => | |
val response = HttpResponse( | |
StatusCodes.OK, | |
HttpEntity( | |
ContentType(MediaTypes.CustomMediaType("text/event-stream"), HttpCharsets.`UTF-8`), | |
"" | |
), | |
List(HttpHeaders.Connection("Keep-Alive")) | |
) | |
ctx.responder ! ChunkedResponseStart(response) | |
val eventSource = context.actorOf(Props(classOf[EventSource], ctx.responder)) | |
} | |
} ~ | |
path("") { getFromFile(s"$staticDir/index.html") } ~ | |
pathPrefix("") { getFromDirectory(staticDir) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment