-- | Run mig-server with warp
module Mig.Server.Warp (
  runServer,
  runServer',
  ServerConfig (..),
  FindRouteType (..),
  CacheConfig (..),
) where

import Data.Default
import Mig.Core
import Mig.Core.Server.Cache
import Mig.Server.Wai
import Network.Wai.Handler.Warp qualified as Warp

runServer :: Int -> Server IO -> IO ()
runServer :: Int -> Server IO -> IO ()
runServer Int
port Server IO
server = Int -> Application -> IO ()
Warp.run Int
port (ServerConfig -> Server IO -> Application
toApplication forall a. Default a => a
def Server IO
server)

runServer' :: ServerConfig -> Int -> Server IO -> IO ()
runServer' :: ServerConfig -> Int -> Server IO -> IO ()
runServer' ServerConfig
config Int
port Server IO
server = Int -> Application -> IO ()
Warp.run Int
port (ServerConfig -> Server IO -> Application
toApplication ServerConfig
config Server IO
server)