Add documentation and handler (#77)

This commit is contained in:
2024-06-07 12:04:00 -04:00
parent b07532ab50
commit 8ee3c6b483
5 changed files with 275 additions and 109 deletions

View File

@@ -278,13 +278,16 @@ module Components =
requireUser >=> renderComponent [ RequestId.ofString requestId |> Views.Journal.snooze ]
/// / URL
/// / URL and documentation
module Home =
// GET /
let home : HttpHandler =
partialStatic "Welcome!" Views.Layout.home
// GET /docs
let docs : HttpHandler =
partialStatic "Documentation" Views.Docs.index
/// /journal URL
module Journal =
@@ -296,7 +299,7 @@ module Journal =
|> Seq.tryFind (fun c -> c.Type = ClaimTypes.GivenName)
|> Option.map (_.Value)
|> Option.defaultValue "Your"
let title = usr |> match usr with "Your" -> sprintf "%s" | _ -> sprintf "%s's"
let title = usr |> match usr with "Your" -> sprintf "%s" | _ -> sprintf "%s’s"
return! partial $"{title} Prayer Journal" (Views.Journal.journal usr) next ctx
}
@@ -530,6 +533,7 @@ let routes = [
routef "request/%s/snooze" Components.snooze
]
]
GET_HEAD [ route "/docs" Home.docs ]
GET_HEAD [ route "/journal" Journal.journal ]
subRoute "/legal/" [
GET_HEAD [