Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autowire akka http - updates #51

Open
wants to merge 3 commits into
base: autowire-akka-http
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ val example = crossProject.settings(
).jvmSettings(
name := "Server",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http-experimental" % "2.4.11",
"com.typesafe.akka" %% "akka-actor" % "2.4.12",
"com.typesafe.akka" %% "akka-http" % "10.0.5",
"com.typesafe.akka" %% "akka-actor" % "2.4.17",
"org.webjars" % "bootstrap" % "3.2.0"
)
)
Expand Down
4 changes: 1 addition & 3 deletions example/js/src/main/scala/example/ScalaJSExample.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package example
import scala.scalajs.js.annotation.JSExport
import org.scalajs.dom
import org.scalajs.dom.html
import scala.util.Random
import scala.concurrent.Future
import scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scalajs.concurrent.JSExecutionContext.Implicits.queue
import scalatags.JsDom.all._
import upickle.default._
import upickle.Js
Expand Down
5 changes: 3 additions & 2 deletions example/jvm/src/main/scala/example/Server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

object Template{
import scalatags.Text.all._
Expand Down Expand Up @@ -53,12 +54,12 @@ object Server extends Api {
} ~
post {
path("api" / Segments){ s =>
extract(entity(as[String])) { e =>
extractStrictEntity(300.millis) { e =>
complete {
AutowireServer.route[Api](Server)(
autowire.Core.Request(
s,
upickle.json.read(e).asInstanceOf[Js.Obj].value.toMap
upickle.json.read(e.data.utf8String).asInstanceOf[Js.Obj].value.toMap
)
).map(upickle.json.write(_))
}
Expand Down