Minion. Experimental HTTP router

I’ve just released library that helps to build web applications. It is situated between scotty and servant, avoiding complex types (where possible), while at the same time providing a typed interface and introspection capabilities.

Here is “hello, world” using Minion. More can be found at Hackage (Web.Minion.Examples.*) and Github

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
module Main where

import Web.Minion
import Network.Wai.Handler.Warp qualified as Warp

main :: IO ()
main = Warp.run 9001 app

app :: ApplicationM IO
app = serve api 

api :: Router Void IO
api = "api" /> 
    [ "about" 
       /> handlePlainText @String GET about
    , "hello" 
       /> capture @String "name" 
       .> handlePlainText @String GET hello
    ]
  where 
    about = pure "Hello-World Minion server"
    hello name = pure $ "Hello, " <> name <> "!"
16 Likes