Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import akka.actor.ActorSystem
- import akka.stream.ActorMaterializer
- import akka.http.scaladsl.Http
- import akka.http.scaladsl.server.Directives._
- /**
- * Created by trishLEX on 03.07.2017.
- */
- object WebServer {
- def main(args: Array[String]) {
- implicit val actorSystem = ActorSystem("system")
- implicit val actorMaterializer = ActorMaterializer()
- val route =
- pathSingleSlash {
- complete("root")
- } ~
- pathPrefix("digit") {
- pathEndOrSingleSlash {
- complete("here a digit")
- } ~
- path(IntNumber) { int =>
- complete(if (int % 2 == 0) "even digit" else "odd digit")
- }
- }
- Http().bindAndHandle(route,"localhost",8080)
- println("server started at 8080")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement