Last active
April 29, 2019 13:51
-
-
Save cokeSchlumpf/b4ffdf21b7ea386618e9080e0a1b2018 to your computer and use it in GitHub Desktop.
Sample Application Snippets
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
package com.example | |
object SimpleApplication extends App { | |
SimpleServer.startServer("localhost", 8080) | |
} |
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
package com.example | |
import akka.actor.ActorSystem | |
import akka.http.scaladsl.server.{HttpApp, Route} | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl._ | |
object SimpleServer extends HttpApp { | |
implicit val system: ActorSystem = ActorSystem.create("test") | |
implicit val materializer: ActorMaterializer = ActorMaterializer() | |
lazy val text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." | |
override protected def routes: Route = get { | |
Source(text.split("\\s").toList) | |
.map(_.toUpperCase) | |
.runWith(Sink.foreach(println)) | |
complete("ok") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment