MyNixOS website logo
Description

Embed a raw 'Application' in a Servant API.

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.

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

Metadata

Version

1.0.0.0

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows