efim bd38a29b6d backend: move roomService usage to httpService
no longer used in auth module,
ready to connect rest routes to room service
2023-04-28 00:46:25 +04:00

32 lines
814 B
Scala

package industries.sunshine.planningpoker
import cats.effect._
import cats.syntax.all._
import com.comcast.ip4s._
import org.http4s.ember.server._
import fs2._
object BackendApp extends IOApp {
override def run(args: List[String]): IO[ExitCode] = {
val host = host"0.0.0.0"
val port = port"8080"
val wiring = for {
roomService <- Resource.eval(RoomService.make[IO])
auth <- Resource.eval(Auth.make[IO]())
httpService = MyHttpService.create(auth, roomService)
server <- EmberServerBuilder
.default[IO]
.withHost(host)
.withPort(port)
.withHttpWebSocketApp(httpService(_))
.build
} yield server
wiring.use(server =>
IO.delay(println(s"Server Has Started at ${server.address}")) >> IO.never.as(ExitCode.Success))
}
}