Skip to content

Instantly share code, notes, and snippets.

@cokeSchlumpf
Last active April 29, 2019 13:51
Show Gist options
  • Save cokeSchlumpf/b4ffdf21b7ea386618e9080e0a1b2018 to your computer and use it in GitHub Desktop.
Save cokeSchlumpf/b4ffdf21b7ea386618e9080e0a1b2018 to your computer and use it in GitHub Desktop.
Sample Application Snippets
package com.example
object SimpleApplication extends App {
SimpleServer.startServer("localhost", 8080)
}
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