So, I want to add two wai middlewares to my servant server. One middleware for serving static files, and one for logging.
I have my api defined (router
) and this is how I start my server :
webServer :: IO ()
webServer = run 80 (middleware $ router)
And here is how I defined my middleware
:
middleware :: Application -> Application
middleware = do
logStdoutDev
staticPolicy $ addBase "static"
Now, if I put logStdoutDev
first than I can't serve static files, but if I put staticPolicy
first, than I can serve static files but I loose ability to log events (basically they get ignored).
Question is really, how to properly combine wai
middleware in servant.