From df879037d135c0b300735185d5fdc0857ed797d6 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Tue, 4 Nov 2025 09:06:01 +0100 Subject: Serve index.html when requesting '/' --- lambda-calcul/haskell/src/Minilang/App.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lambda-calcul/haskell/src/Minilang/App.hs') diff --git a/lambda-calcul/haskell/src/Minilang/App.hs b/lambda-calcul/haskell/src/Minilang/App.hs index 2d21961..8c1fb2b 100644 --- a/lambda-calcul/haskell/src/Minilang/App.hs +++ b/lambda-calcul/haskell/src/Minilang/App.hs @@ -1,14 +1,20 @@ module Minilang.App where -import Minilang.API (LambdaAPI, Score (..)) -import Servant.Server (Handler, Server) -import Data.Time (getCurrentTime) import Control.Monad.IO.Class (liftIO) +import Data.Time (getCurrentTime) +import Minilang.API (LambdaAPI, Score (..)) +import Network.Wai.Application.Static (defaultFileServerSettings, staticApp) +import Servant ((:<|>) (..)) +import Servant.Server (Application, Handler, Server, Tagged (..)) lambdaApp :: Server LambdaAPI -lambdaApp = getLeaderboard +lambdaApp = getLeaderboard :<|> Tagged staticResources getLeaderboard :: Handler [Score] getLeaderboard = do now <- liftIO getCurrentTime pure [Score "Alice" 95 now, Score "Bob" 88 now] + +-- | Serve static resources under `public/` directory +staticResources :: Application +staticResources = staticApp (defaultFileServerSettings "public") -- cgit v1.3.1