servant-rawm
servant-rawm copied to clipboard
Unable to use Servant.RawM based on documentation examples
Hi, I'm trying to write a raw webhook endpoint due to this complication in the Accept
header. Here's what I've got:
data Env = Env {..} -- my application's reader environment
type AppM = ReaderT Env IO
type Routes = "lambda" :> "webhook" :> RawM
server :: ServerT Routes AppM
server = saveWebhookPayload
saveWebhookPayload :: AppM Wai.Application
saveWebhookPayload = do
env_ <- getEnv
pure $ \req respond -> do
-- my Wai application here that uses the env_
I'm getting the following compiler error:
• Couldn't match type ‘ServerT (RawM' FileServer) (ReaderT Env IO)’
with ‘ReaderT Env IO Application’
Expected type: ServerT Routes AppM
Actual type: AppM Application
• In the expression: saveWebhookPayload
In an equation for ‘server’: server = saveWebhookPayload
What am I doing wrong? Is this supposed to be used only for static file serving?