Setup example module with JS bundle configured

This commit is contained in:
Paul-Henri Froidmont 2025-08-21 18:19:08 +02:00
parent 486e89c1f1
commit aae3db841b
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
7 changed files with 39 additions and 7 deletions

3
example/js/src/app.js Normal file
View file

@ -0,0 +1,3 @@
import { scalive } from "core/js/index"
console.log(scalive)

View file

@ -17,4 +17,6 @@ object Example extends ZIOAppDefault:
)
)
override val run = Server.serve(liveRouter.routes).provide(Server.default)
val routes = liveRouter.routes @@ Middleware.serveResources(Path.empty / "static", "public")
override val run = Server.serve(routes).provide(Server.default)

View file

@ -5,7 +5,8 @@ object RootLayout:
htmlRootTag(
lang := "en",
headTag(
metaTag(charset := "utf-8")
metaTag(charset := "utf-8"),
scriptTag(defer := true, typ := "text/javascript", src := "/static/app.js")
),
bodyTag(
content