mirror of
https://github.com/phfroidmont/scalive.git
synced 2025-12-25 05:26:59 +01:00
Fix JS build and move example to its own module
This commit is contained in:
parent
73510857a6
commit
486e89c1f1
5 changed files with 64 additions and 63 deletions
20
example/src/Example.scala
Normal file
20
example/src/Example.scala
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import zio.*
|
||||
import zio.http.*
|
||||
import scalive.*
|
||||
|
||||
object Example extends ZIOAppDefault:
|
||||
|
||||
val liveRouter =
|
||||
LiveRouter(
|
||||
RootLayout(_),
|
||||
List(
|
||||
LiveRoute(
|
||||
Root,
|
||||
(_, req) =>
|
||||
val q = req.queryParam("q").map("Param : " ++ _).getOrElse("No param")
|
||||
ExampleLiveView(q)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
override val run = Server.serve(liveRouter.routes).provide(Server.default)
|
||||
Loading…
Add table
Add a link
Reference in a new issue