Skip to content

mrkaspa/PlayJsonAkkaHttpMarshalling

Repository files navigation

PlayJsonAkkaHttpMarshalling

PlayJson Marshalling for Akka Http and catching errors

Use Example:

build.sbt

resolvers ++= Seq(
  "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
)

libraryDependencies ++= {
  Seq(
    "com.kreattiewe.akka" %% "play-json-marshalling" % "1.0"  
    )
}
//Here you catch the errors
val myRejectionHandler = RejectionHandler.newBuilder()
    .handle {
    case MalformedRequestContentRejection(msg, cause) =>
      complete(StatusCodes.BadRequest, cause.get.asInstanceOf[JsonParseThrowable].errors)
  }.result()
  
val routes =
  (logRequestResult("") & handleRejections(myRejectionHandler)) {
    path("login") {
      (post & entity(as[LoginRequest])) {
        complete {}
      }
    }
  }

#Changelog

1.0.1

  • Support for akka http 1.0-RC2

1.0

  • Support for akka http 1.0-M5
  • CRUD For Relationships

About

PlayJson Marshalling for Akka Http

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages