Created
May 4, 2019 12:41
-
-
Save adamw/c35b89a8cc4bdce41daffcdb703bbf78 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def startServer(): Unit = { | |
import scala.concurrent.Await | |
import scala.concurrent.duration._ | |
import akka.http.scaladsl.server.Directives._ | |
import akka.http.scaladsl.server.Route | |
import akka.http.scaladsl.Http | |
import akka.actor.ActorSystem | |
import akka.stream.ActorMaterializer | |
val routes: Route = getBooksRoute ~ getBookCoverRoute ~ addBookRoute | |
implicit val actorSystem: ActorSystem = ActorSystem() | |
implicit val materializer: ActorMaterializer = ActorMaterializer() | |
Await.result(Http().bindAndHandle(routes, "localhost", 8080), 1.minute) | |
println("Server started!") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment