mig-server: Build lightweight and composable servers

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

With library mig we can build lightweight and composable servers. There are only couple of combinators to assemble servers from parts. It supports generic handler functions as servant does. But strives to use more simple model for API. It does not go to describing Server API at type level which leads to simpler error messages.

The main features are:

Example of hello world server:

{-# Language OverloadedStrings #-}
import Mig.Json.IO

-- | We can render the server and run it on port 8085.
-- It uses wai and warp.
main :: IO ()
main = runServer 8085 server

-- | Init simple hello world server whith two routes:
server :: Server IO
server =
  "api/v1" /.
      [ "hello" /. hello
      , "bye" /. bye
      ]

-- | Handler takes no inputs and marked as Get HTTP-request that returns Text.
hello :: Get (Resp Text)
hello = pure $ ok "Hello World"

-- | Handle with URL-param query and json body input as Post HTTP-request that returns Text.
bye :: Query "name" Text -> Body Text -> Post (Resp Text)
bye (Query name) (Body greeting) =
  pure $ ok $ "Bye to " <> name <> " " <> greeting

Please see:


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.2.1.0, 0.2.2.0, 0.2.2.0
Change log None available
Dependencies aeson, base (>=4.7 && <5), blaze-html, data-default, http-api-data, http-types, mig (>=0.2.1.0), mig-extra (>=0.1.1.0), mig-swagger-ui (>=0.1.1), mig-wai (>=0.1.0.1), openapi3, text, transformers, warp [details]
License BSD-3-Clause
Copyright 2023 Anton Kholomiov
Author Anton Kholomiov
Maintainer anton.kholomiov@gmail.com
Category Web
Home page https://github.com/anton-k/mig#readme
Bug tracker https://github.com/anton-k/mig/issues
Source repo head: git clone https://github.com/anton-k/mig
Uploaded by AntonKholomiov at 2026-02-16T11:32:13Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for mig-server-0.2.2.0

[back to package description]

mig-server