adding backend project
will try to do rest & websocket api with http4s
This commit is contained in:
parent
7e488b7e62
commit
d8af92787d
|
@ -0,0 +1,32 @@
|
||||||
|
package industries.sunshine.planningpoker
|
||||||
|
|
||||||
|
import cats.effect._
|
||||||
|
import cats.syntax.all._
|
||||||
|
import org.http4s._, org.http4s.dsl.io._, org.http4s.implicits._
|
||||||
|
import com.comcast.ip4s._
|
||||||
|
import org.http4s.HttpRoutes
|
||||||
|
import org.http4s.dsl.io._
|
||||||
|
import org.http4s.implicits._
|
||||||
|
import org.http4s.ember.server._
|
||||||
|
|
||||||
|
object App extends IOApp.Simple {
|
||||||
|
|
||||||
|
val service = HttpRoutes
|
||||||
|
.of[IO] { case _ =>
|
||||||
|
Ok("hello")
|
||||||
|
}
|
||||||
|
.orNotFound
|
||||||
|
|
||||||
|
override def run: IO[Unit] = {
|
||||||
|
val a = 1
|
||||||
|
IO.println(s"Hello, World! $a") >>
|
||||||
|
EmberServerBuilder
|
||||||
|
.default[IO]
|
||||||
|
.withHost(ipv4"0.0.0.0")
|
||||||
|
.withPort(port"8080")
|
||||||
|
.withHttpApp(service)
|
||||||
|
.build
|
||||||
|
.use(_ => IO.never)
|
||||||
|
.as(ExitCode.Success)
|
||||||
|
}
|
||||||
|
}
|
34
build.sbt
34
build.sbt
|
@ -1,10 +1,14 @@
|
||||||
import org.scalajs.linker.interface.ModuleSplitStyle
|
import org.scalajs.linker.interface.ModuleSplitStyle
|
||||||
|
|
||||||
lazy val planningPokerGrargh = project
|
lazy val commonSettings = Seq(
|
||||||
.in(file("."))
|
scalaVersion := "3.2.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val frontend = project
|
||||||
|
.in(file("frontend"))
|
||||||
.enablePlugins(ScalaJSPlugin) // Enable the Scala.js plugin in this project
|
.enablePlugins(ScalaJSPlugin) // Enable the Scala.js plugin in this project
|
||||||
.settings(
|
.settings(
|
||||||
scalaVersion := "3.2.0",
|
commonSettings,
|
||||||
|
|
||||||
// Tell Scala.js that this is an application with a main method
|
// Tell Scala.js that this is an application with a main method
|
||||||
scalaJSUseMainModuleInitializer := true,
|
scalaJSUseMainModuleInitializer := true,
|
||||||
|
@ -29,3 +33,27 @@ lazy val planningPokerGrargh = project
|
||||||
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.4.0",
|
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.4.0",
|
||||||
libraryDependencies += "com.raquo" %%% "laminar" % "15.0.1"
|
libraryDependencies += "com.raquo" %%% "laminar" % "15.0.1"
|
||||||
)
|
)
|
||||||
|
.dependsOn(common)
|
||||||
|
|
||||||
|
lazy val backend = project
|
||||||
|
.in(file("backend"))
|
||||||
|
.settings(
|
||||||
|
commonSettings,
|
||||||
|
libraryDependencies ++= Seq(
|
||||||
|
"org.http4s" %% "http4s-ember-client" % http4sVersion,
|
||||||
|
"org.http4s" %% "http4s-ember-server" % http4sVersion,
|
||||||
|
"org.http4s" %% "http4s-dsl" % http4sVersion
|
||||||
|
),
|
||||||
|
// available for 2.12, 2.13, 3.2
|
||||||
|
libraryDependencies += "co.fs2" %% "fs2-core" % "3.6.1",
|
||||||
|
libraryDependencies += "org.typelevel" %% "cats-core" % "2.9.0",
|
||||||
|
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.4.9"
|
||||||
|
)
|
||||||
|
.dependsOn(common)
|
||||||
|
|
||||||
|
val http4sVersion = "1.0.0-M39"
|
||||||
|
lazy val common = project
|
||||||
|
.in(file("common"))
|
||||||
|
.settings(
|
||||||
|
commonSettings
|
||||||
|
)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package industries.sunshine.planningpoker
|
package industries.sunshine.planningpoker.common
|
||||||
|
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
|
object Models {
|
||||||
/** view of the single planning poker round
|
/** view of the single planning poker round
|
||||||
* @param players
|
* @param players
|
||||||
* \- people who are currently playing
|
* \- people who are currently playing
|
||||||
|
@ -67,3 +68,5 @@ final case class ViewingRound(
|
||||||
|
|
||||||
final class PlayerID
|
final class PlayerID
|
||||||
final case class Player(name: String, id: PlayerID)
|
final case class Player(name: String, id: PlayerID)
|
||||||
|
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package industries.sunshine.planningpoker
|
||||||
import scala.scalajs.js
|
import scala.scalajs.js
|
||||||
import scala.scalajs.js.annotation.*
|
import scala.scalajs.js.annotation.*
|
||||||
import com.raquo.laminar.api.L.{*, given}
|
import com.raquo.laminar.api.L.{*, given}
|
||||||
|
import industries.sunshine.planningpoker.common.Models.*
|
||||||
|
|
||||||
import org.scalajs.dom
|
import org.scalajs.dom
|
||||||
|
|
|
@ -2,6 +2,7 @@ package industries.sunshine.planningpoker
|
||||||
|
|
||||||
import scala.scalajs.js
|
import scala.scalajs.js
|
||||||
import com.raquo.laminar.api.L.{*, given}
|
import com.raquo.laminar.api.L.{*, given}
|
||||||
|
import industries.sunshine.planningpoker.common.Models.*
|
||||||
|
|
||||||
/** Rendering of the Room state
|
/** Rendering of the Room state
|
||||||
*/
|
*/
|
|
@ -3,6 +3,7 @@ package industries.sunshine.planningpoker
|
||||||
import scala.scalajs.js
|
import scala.scalajs.js
|
||||||
import com.raquo.laminar.api.L.{*, given}
|
import com.raquo.laminar.api.L.{*, given}
|
||||||
import scala.scalajs.js.Dynamic.{global => g}
|
import scala.scalajs.js.Dynamic.{global => g}
|
||||||
|
import industries.sunshine.planningpoker.common.Models.*
|
||||||
|
|
||||||
object TableView {
|
object TableView {
|
||||||
// new plan. map to players, split by playerId, map into specific card
|
// new plan. map to players, split by playerId, map into specific card
|
Loading…
Reference in New Issue