Newer
Older
miracle-tv-backend / src / main / scala / Main.scala
import org.apache.pekko.actor.typed.ActorSystem
import org.apache.pekko.actor.typed.scaladsl.Behaviors
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.server.Route.seal
import io.circe.generic.auto._, io.circe.syntax._
import io.getquill._
import java.sql.SQLException
import io.getquill.jdbczio.Quill.DataSource

import tv.miracle.backend.graphql.GraphQL

import io.circe.Json
import tv.miracle.backend.db.DB

case class Ping(ping: String)
case class Test(name: String, sexy: Option[Boolean])

object Main {
  def main(args: Array[String]): Unit = {
    implicit val ctx = DB.ctx()

    implicit val system = ActorSystem(Behaviors.empty, "my-system")

    implicit val executionContext = system.executionContext

    val route =
      path("graphql") { GraphQL.handleGraphQL() }

    val bindingFuture = Http().newServerAt("localhost", 8080).bind(route)

    println(s"Server now online. Please navigate to http://localhost:8080/hello\n")
  }
}