Package morph 0.6.1

A web framework built ontop of Httpaf and H2 using reusable middlewares.

The entry point of this library is the module: Morph.

Core concepts

When you start a Morph server you can provide a list of middlewares to be run on every request and a handler. The middleware/handler chain will be provided with a Morph.Request.t and expects it to return a Morph.Response.t that it will use to send a response.

I will use Filter/Middleware and Service/Handler interchangeably in the documentation.

Goals

The main goal for Morph is to be a simpler way of writing web servers in OCaml than using Cohttp and Httpaf/H2 but still be flexible enough to handle most usecases. If you can find a usecase that we don't satisfy in the current implementation please open a issue or ping @ulrikstrid on Discord to see if we can figure it out.

Examples

A simple "Hello world!" can be built as follows:

Morph.start_server(_request => Morph.Response.text("Hello world!"))
|> Lwt_main.run;

For more examples go to the reason-native-web homepage or look in the examples folder of this project.

Package info

authors
  • Ulrik Strid
changes-files
depends
homepage
issues
maintainers
  • Ulrik Strid
online-doc
readme-files
repo
  • git+https://github.com/reason-native-web/morph.git
version
  • 0.6.1