Skip to content

Instantly share code, notes, and snippets.

@manjotmona
Last active June 10, 2018 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manjotmona/9e556b9210638adcba948f9db729f818 to your computer and use it in GitHub Desktop.
Save manjotmona/9e556b9210638adcba948f9db729f818 to your computer and use it in GitHub Desktop.
trait RestService {
implicit val userFormat = jsonFormat2(User)
val userImpl: UserImpl
val route =
post {
path("adduser") {
entity(as[User]) { user =>
val saved: Future[Done] = userImpl.addUser(user)
onComplete(saved) { _ =>
complete("user added")
}
}
}
}
}
class RestServiceImpl extends RestService {
val userImpl = UserImpl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment