Giter VIP home page Giter VIP logo

servant-rawm's Introduction

Servant.RawM

CI 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

servant-rawm's People

Contributors

amesgen avatar cdepillabout avatar jhrcek avatar krasjet avatar profpatsch avatar vlatkob avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.