I’m happy to announce the latest release of mig-0.2 library. It is a library to write composable servers for simple / boring haskell. The main focus of this release is the ability to serve Swagger UI from the server with ease and ability to create clients from the same code as servers. I’m happy to confirm that both goals are reached with this release.
The tutorial for library was created.
Also there are many other improvements:
- OpenApi schema for servers
- swagger servers support (we can add swagger to server with one line of code:
withSwagger def server)
- clients from the same code as servers
- redesign of internal types
- redesign of DSL for routes
- many ergonomic improvements
- packages for extra utils
- split of
migpackage to several packages:
- tutorial and quickstart guide on github pages
- CI for repo with formatter, build and tests and update of docs on github pages
The internal type for Servers was redesigned so that we assemble handler function with API description at the same time. In the first release it was just handler function under the hood.
As a refresher
mig is a family of libraries to write lightweight, simple, type-safe and composable servers. It strives to be in the middle ground between scotty and servant. To be composable, flexible and type-safe as servant and simple and lightweight in concepts as scotty.
One thing that interesting to think about as Server is a first-class value and all servers have the same type and we have just a small number of functions to compose them (they are link server to path and make alternative routes with
Monoid) it’s interesting to explore the possibility of creation small grain-like servers for typical tasks. For example server can be a function from interfaces (logging, DB or something else) to server value and we can join them together on various paths. This idea is interesting to consider.
Thanks to Ambros for contribution. Also I’d like to thank authors of packages servant, servant-swagger-ui and servant-openapi3 packages for inspiration for my work in this release. Many lines of code are influenced by those packages.