diff options
Diffstat (limited to 'Omni/Jr/Web.hs')
| -rw-r--r-- | Omni/Jr/Web.hs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs new file mode 100644 index 0000000..bb28e93 --- /dev/null +++ b/Omni/Jr/Web.hs @@ -0,0 +1,40 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE NoImplicitPrelude #-} + +-- | Jr Web UI - Main module that re-exports the API and provides the run function. +-- +-- The web interface is split into submodules: +-- - Types: Data types for pages, partials, and forms +-- - Components: Reusable UI components and helpers +-- - Pages: Full page ToHtml instances +-- - Partials: HTMX partial ToHtml instances +-- - Handlers: Servant handler implementations +-- - Style: CSS styling +-- +-- : dep warp +-- : dep servant-server +-- : dep lucid +-- : dep servant-lucid +module Omni.Jr.Web + ( run, + defaultPort, + -- Re-exports for external use + API, + server, + ) +where + +import Alpha +import qualified Network.Wai.Handler.Warp as Warp +import Omni.Jr.Web.Handlers (API, api, server) +import Omni.Jr.Web.Pages () +import Omni.Jr.Web.Partials () +import Servant (serve) + +defaultPort :: Warp.Port +defaultPort = 8080 + +run :: Warp.Port -> IO () +run port = do + putText <| "Starting Jr web server on port " <> tshow port + Warp.run port (serve api server) |
