/frontend/src/main/scala/com/boldradius/akka_exchange/frontend/FrontendNodeApp.scala

https://github.com/boldradius/akka-exchange · Scala · 45 lines · 20 code · 8 blank · 17 comment · 0 complexity · a047940593446c7a64cf53e76eeb4fb9 MD5 · raw file

  1. /**
  2. * Copyright © 2015, BoldRadius Solutions
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.boldradius.akka_exchange.frontend
  17. import akka.http.scaladsl.Http
  18. import akka.http.scaladsl.server.Directives._
  19. import akka.stream.ActorMaterializer
  20. import com.boldradius.akka_exchange.util.ExchangeNodeBootable
  21. object FrontendNodeApp extends ExchangeNodeBootable {
  22. import net.ceedubs.ficus.Ficus._
  23. implicit val materializer = ActorMaterializer()
  24. val route =
  25. path("offers") {
  26. get {
  27. complete {
  28. "Here's some data... or would be if we had data."
  29. }
  30. }
  31. }
  32. val httpPort = config.as[Int]("akka-exchange.cluster.frontend.port")
  33. // todo - make me based on local address so we don't need special config that locks out multiple http nodes
  34. val httpAddr = config.as[String]("akka-exchange.cluster.frontend.address")
  35. Http().bindAndHandle(route, httpAddr, httpPort)
  36. }
  37. // vim: set ts=2 sw=2 sts=2 et: