@@ -116,12 +116,11 @@ runWidget conf frontend validFullEncoder = do
116116
117117obeliskApp :: forall route backendRoute. ConnectionOptions -> Frontend (R route) -> ValidEncoder (Either Text) (R (Sum backendRoute (ObeliskRoute route))) PageName -> Application -> IO Application
118118obeliskApp opts frontend validFullEncoder backend = do
119− html <- BSLC.fromStrict <$> indexHtml blank --TODO: Something other than `blank` here?
120119 let entryPoint = do
121120 runFrontend validFullEncoder frontend
122121 syncPoint
123122 Right (jsaddleWarpRouteValidEncoder :: ValidEncoder (Either Text) (R JSaddleWarpRoute) PageName) <- return $ checkEncoder jsaddleWarpRouteEncoder
124− jsaddle <- jsaddleWithAppOr opts entryPoint $ error "obeliskApp: jsaddle got a bad URL"
123+ jsaddle <- jsaddleWithAppOr opts entryPoint $ \_ sendResponse -> sendResponse $ W.responseLBS H.status500 [("Content-Type", "text/plain")] "obeliskApp: jsaddle got a bad URL"
125124 return $ \req sendResponse -> case _validEncoder_decode validFullEncoder (W.pathInfo req, mempty) of --TODO: Query strings
126125 Left e -> sendResponse $ W.responseLBS H.status404 [("Content-Type", "text/plain")] $ LBS.fromStrict $ encodeUtf8 e
127126 Right r -> case r of
@@ -130,7 +129,9 @@ obeliskApp opts frontend validFullEncoder backend = do
130129 _ -> flip jsaddle sendResponse $ req
131130 { W.pathInfo = fst $ _validEncoder_encode jsaddleWarpRouteValidEncoder jsaddleRoute
132131 }
133− InR (ObeliskRoute_App _) :=> _ -> sendResponse $ W.responseLBS H.status200 [("Content-Type", "text/html")] html
132+ InR (ObeliskRoute_App appRouteComponent) :=> Identity appRouteRest -> do
133+ html <- fmap BSLC.fromStrict $ indexHtml $ fmap fst $ runEventWriterT $ flip runRoutedT (pure $ appRouteComponent :/ appRouteRest) $ _frontend_head frontend
134+ sendResponse $ W.responseLBS H.status200 [("Content-Type", "text/html")] html
134135 _ -> backend req sendResponse
135136
136137indexHtml :: StaticWidget () () -> IO ByteString