aboutsummaryrefslogtreecommitdiff
path: root/lib/Server.hs
diff options
context:
space:
mode:
authorstuebinm2022-08-14 15:44:19 +0200
committerstuebinm2022-08-14 15:44:19 +0200
commitce14bc010a8f97cd3bab6f5cbd998f614b811546 (patch)
tree854b2726c68b9be3925d8ad222f6afce8b2378a7 /lib/Server.hs
parentf13e72076dbdcf0cd53d8558fccbedb98b8ea492 (diff)
controlroom: replace servant/lucid with yesod
aka use something meant for webapps to write the webapp
Diffstat (limited to 'lib/Server.hs')
-rw-r--r--lib/Server.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Server.hs b/lib/Server.hs
index cc86cd2..24f29f9 100644
--- a/lib/Server.hs
+++ b/lib/Server.hs
@@ -47,6 +47,9 @@ import Persist
import Server.ControlRoom
import Server.GTFS_RT (gtfsRealtimeServer)
import Server.Util (Service, ServiceM, runService)
+import Yesod (toWaiAppPlain)
+
+import System.IO.Unsafe
application :: GTFS -> Pool SqlBackend -> IO Application
application gtfs dbpool = do
@@ -65,7 +68,7 @@ server gtfs@GTFS{..} dbpool = handleDebugAPI :<|> (handleStations :<|> handleTim
:<|> handleRegister :<|> handleTripPing :<|> handleWS :<|> handleDebugState :<|>
gtfsRealtimeServer gtfs dbpool
:<|> adminServer gtfs dbpool)
- :<|> controlRoomServer gtfs dbpool
+ :<|> pure (unsafePerformIO (toWaiAppPlain (ControlRoom "http://localhost:4000/cr" gtfs dbpool)))
where handleStations = pure stations
handleTimetable station maybeDay = do
-- TODO: resolve "overlay" trips (perhaps just additional CalendarDates?)