nero

Lens-based HTTP toolkit https://github.com/plutonbrb/nero

Latest on Hackage:0.3.1

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Danny Navarro
Maintained by Danny Navarro

Nero

A Lens-based HTTP toolkit.

:warning: The following is a declaration of intentions. Expect wild changes in the API until the 1.0.0 release.

  • Not a framework: it may be considered an anti-framework, micro-framework, or just a "library", in the sense that it provides a set of utilities for building custom web applications instead of creating applications from user provided code following certain structure.

  • Pay for what you eat: instead of coming with everything and the kitchen sink, it provides the bare minimum to write applications with minimum implicit behavior. At the same time, it offers diverse paths to grow with you as applications become more complex.

  • Unopinonated: there is no preferred routing method, HTML templating library, session management, web server or database adapter. It comes with some defaults to alleviate the paradox of choice, but most components are expected to be easily swapped in and out either with plain 3rd party Haskell libraries or by writing thin adapters around them.

  • Power of Haskell and Lens: the Lens-based API enables a style familiar to imperative programmers Lens while being purely functional under the hood. Veteran Haskellers can take advantage of the powerful lens combinators.

Hackage Version Build Status

Example

{-# LANGUAGE OverloadedStrings #-}
import Nero.Prelude
import Nero (Request, Response, _GET, prefixed, ok)
import Nero.Warp (serve) -- from `nero-warp`

app :: Request -> Maybe Response
app request = request ^? _GET . prefixed "/hello/" <&> \name ->
    ok $ "<h1>Hello " <> name <> "</h1>"

main :: IO ()
main = serve 8080 app

More examples in the examples directory.

Changes

Change Log

All notable changes to this project will be documented in this file. This file follows the formatting recommendations from Keep a CHANGELOG. This project adheres to Semantic Versioning.

0.3.1 - 2015-4-16

Fixed

  • Make examples private modules so they can be built.

Added

  • Lower bounds versions for dependencies.

0.3 - 2015-4-12

This release includes changes driven by the initial implementation of nero-wai. ### Changed - GET and POST are now types on their own instead of constructors for Request. Request is now sum type wrapper for the types GET and POST - Payloaded is now a Lens' and has been renamed to HasPayload. Request is not an instance of HasPayload anymore, instead use payloaded. - Rename server -> application in Server type class.

Added

  • split for combining match and sep.
  • notFound response.
  • payloaded Prism' for Request Payloads.
  • HasBody instance for Request.
  • Prism' for Responses with different status.
  • null, fromList for MultiMap.
  • Binary module including Renderable and Parseable classes.
  • Renderable instance for Url.
  • Single Response instance for Server.

0.2 - 2015-4-5

Changed

  • Replace basic routing (monoidal matching) with lens routing.
  • Limit exports for central module Nero.

Added

  • Custom Prelude (Nero.Prelude) extended with frequently used imports.

0.1.1 - 2015-3-30

Fixed

  • Support for ghc-7.6.3 and ghc-7.10.1.

0.1 - 2015-3-30

Added

  • Basic routing.
  • HTTP parameters handling for both query string and form encoded POSTs.
  • Trailing slash redirection.
Used by 2 packages:
comments powered byDisqus