{-# LANGUAGE OverloadedStrings #-}
module Rib.Server
( serve,
)
where
import Network.Wai.Application.Static (defaultFileServerSettings, ssListing, staticApp)
import qualified Network.Wai.Handler.Warp as Warp
import Relude
import WaiAppStatic.Types (StaticSettings)
staticSiteServerSettings :: FilePath -> StaticSettings
staticSiteServerSettings root =
defaultSettings
{ ssListing = Nothing
}
where
defaultSettings = defaultFileServerSettings root
serve ::
Int ->
FilePath ->
IO ()
serve port path = do
putStrLn $ "[Rib] Serving at http://localhost:" <> show port
Warp.run port $ staticApp $ staticSiteServerSettings path