diff options
author | stuebinm | 2022-02-16 16:57:49 +0100 |
---|---|---|
committer | stuebinm | 2022-03-19 19:26:32 +0100 |
commit | ff8eeb131db9e9a0d9d3cef60ddcaa83692fb62c (patch) | |
tree | 8cbb1bad563bd545929b083447e9a11d1a60648d /server/Main.hs | |
parent | 410151c85b1e6c7629934e0ef0bc199d92da64e9 (diff) |
server: add mapservice GET endpoint
Diffstat (limited to '')
-rw-r--r-- | server/Main.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/server/Main.hs b/server/Main.hs index 0d5dfd6..8b41c92 100644 --- a/server/Main.hs +++ b/server/Main.hs @@ -19,9 +19,9 @@ import Control.Concurrent.STM.TQueue (TQueue, newTQueueIO, writeTQueue) import qualified Data.Text as T import Fmt ((+|), (|+)) -import Handlers (AdminOverview, - adminOverviewImpl, - statusImpl) +import Handlers (AdminOverview (AdminOverview), + MapService (MapService), + stateImpl, statusImpl) import HtmlOrphans () import Network.Wai.Handler.Warp (defaultSettings, runSettings, setPort) @@ -43,6 +43,9 @@ import Server (JobStatus, Org (..), import Worker (Job (Job), linterThread) +-- | that thing we need to replace the hub +type MapServiceAPI = "api" :> "maps" :> "list" :> Get '[JSON] MapService + -- | abstract api type API format = -- "submit" :> ReqBody '[JSON] RemoteRef :> Post '[format] UUID @@ -52,17 +55,19 @@ type API format = -- | actual set of routes: api for json & html + static pages from disk type Routes = "api" :> API JSON + :<|> MapServiceAPI :<|> API HTML -- websites mirror the API exactly :<|> Raw -- | API's implementation jsonAPI :: forall format. MVar ServerState -> Server (API format) jsonAPI state = statusImpl state - :<|> adminOverviewImpl state + :<|> stateImpl @AdminOverview state -- | Complete set of routes: API + HTML sites server :: MVar ServerState -> Server Routes server state = jsonAPI @JSON state + :<|> stateImpl @MapService state :<|> jsonAPI @HTML state :<|> serveDirectoryWebApp "./static" |