summaryrefslogtreecommitdiff
path: root/server/Main.hs
diff options
context:
space:
mode:
authorstuebinm2022-02-16 16:57:49 +0100
committerstuebinm2022-02-16 16:57:49 +0100
commitc1988345690b9da7a82020ff72542860fcb1d68a (patch)
tree0ae202a497f37ab5de78fdf2d86fbed143a68a53 /server/Main.hs
parent1fed9563fd75e6528740471f04746138284257b3 (diff)
server: add mapservice GET endpoint
Diffstat (limited to '')
-rw-r--r--server/Main.hs13
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"