quickwebapp-2.1.0.0: A quick webapp generator for any file processing tool

Safe HaskellNone
LanguageHaskell2010

QuickWebApp

Description

A quick-and-dirty api generator, for any function `a -> b` which can be wrapped inside a function `ByteString -> ByteString`. It is inspired from the interact function from Prelude.

Synopsis

Documentation

class ToLBS a where Source

Represents types which can be converted to a Lazy ByteString

Methods

toLBS :: a -> ByteString Source

class FromLBS a where Source

Represents types which can be converted from a Lazy ByteString This is intended for other String-like types

Methods

fromLBS :: ByteString -> a Source

err422 :: Status Source

Unprocessable entity error code (temporary fix for a missing status in http-types)

interactWeb :: (FromLBS a, ToLBS b) => (a -> b) -> IO () Source

Equivalent to 'interactWebOn 3000'

interactWebEither :: (FromLBS a, ToLBS b, ToLBS e) => (a -> Either e b) -> IO () Source

Equivalent to 'interactWebEitherOn 3000'

interactWebOn :: (FromLBS a, ToLBS b) => Int -> (a -> b) -> IO () Source

Create an API with a POST endpoint

interactWebEitherOn :: (FromLBS a, ToLBS b, ToLBS e) => Int -> (a -> Either e b) -> IO () Source

Create an API with a POST endpoint If the function fails and returns a Left value, return a 422 response with the error in the body