summaryrefslogtreecommitdiff
path: root/server/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'server/Main.hs')
-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"