summaryrefslogtreecommitdiff
path: root/Omni/Jr/Web.hs
blob: bb28e93e0318f5007083143a3a0bdecb8b2505d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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)