servant-rawm: Embed a raw 'Application' in a Servant API

[ bsd3, library, servant, text, web ] [ Propose Tags ]

Please see README.md.

After servant-rawm 1.0.0.0, the implementation are divided into three packages: servant-rawm-server, servant-rawm-client, and servant-rawm-docs.

You need to use either of the three implementations for the RawM endpoint to function correctly.


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.3.0.0, 0.3.1.0, 0.3.2.0, 1.0.0.0
Change log CHANGELOG.md
Dependencies base (>=4.8 && <5), servant (>=0.16) [details]
License BSD-3-Clause
Copyright 2017 Dennis Gosnell
Author Dennis Gosnell
Maintainer cdep.illabout@gmail.com , nil.krjst@gmail.com
Category Servant , Web
Home page https://github.com/cdepillabout/servant-rawm
Source repo head: git clone git@github.com:cdepillabout/servant-rawm.git
Uploaded by cdepillabout at 2020-06-27T05:38:57Z
Distributions LTSHaskell:0.3.0.0, NixOS:1.0.0.0
Downloads 3410 total (33 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-06-27 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for servant-rawm-1.0.0.0

[back to package description]

Servant.RawM

Build Status Hackage Stackage LTS Stackage Nightly BSD3 license

servant-rawm provides a way to embed a WAI Application in a Servant handler. It is more convenient and powerful than the Raw type provided by servant.

See the Haddocks on Hackage for servant-rawm for an explanation of how to use the RawM type.

After servant-rawm 1.0.0.0, the implementations of the RawM endpoint are divided into servant-rawm-client, servant-rawm-docs, and servant-rawm-server to avoid introducing unnecessary dependencies and reduce the compilation overhead.

You will need to add either of the implementations to your dependencies, and import the corresponding implementation (Servant.RawM.Server, Servant.RawM.Client, or Servant.RawM.Docs) for the RawM endpoint to function correctly.

Example

There is code for an example server, client, and documentation located in servant-rawm-examples-and-tests/example/. The following section describes how to run the example executables.

Building

The example executables can be built with the following command:

$ stack build servant-rawm-examples-and-tests

Server

After building, the server can be run with the following command:

$ stack exec -- servant-rawm-example-server

This runs a server on port 8201 serving files in servant-rawm-examples-and-tests/example/files/.

It can be accessed from curl like the following:

$ curl http://localhost:8201/serve-directory/foo.txt
This is an example text file.

Client

After building and running the server, the client can be run like the following:

$ stack exec -- servant-rawm-example-client
Successfully got file ./example/files/foo.txt:

This is an example text file.

Documentation

After building, the documentation can be generated like the following. This is documentation for the API defined in servant-rawm-examples-and-tests/example/Api.hs:

$ stack exec -- servant-rawm-example-docs
...

Maintainers