module Minilang.App where 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 :<|> 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")