This commit is contained in:
2024-09-18 13:16:36 -05:00
committed by James Eversole
commit 6e2fb3b9bd
9 changed files with 358 additions and 0 deletions

33
src/Main.hs Normal file
View File

@@ -0,0 +1,33 @@
module Main (main) where
import Core
import Database
import Handlers
import Control.Monad.Except (ExceptT (ExceptT))
import Data.List
import Effectful
import Effectful.Error.Static (Error, runError, runErrorNoCallStack, throwError)
import Effectful.FileSystem
import Network.Wai.Handler.Warp (run)
import Servant hiding ((:>), throwError)
import qualified Servant as S
main :: IO ()
main = run port $ serve proxy app
app :: Server API
app = α $ rootHandler
:<|> userListHandler
:<|> userGetHandler
:<|> userPostHandler
α :: ServerT API AppEff -> ServerT API Handler
α = hoistServer proxy $ Handler . ExceptT .
runEff . runErrorNoCallStack . runFileSystem . runDatabaseIO
port :: Int
port = 8080
proxy :: Proxy API
proxy = Proxy