purescheme-wai-routing-core: Simple Routing functions for Wai Applications

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Please see the README on GitHub at https://github.com/purescheme/purescheme-wai-routing-core#readme


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.1.3.0
Change log ChangeLog.md
Dependencies aeson, base (>=4.7 && <5), bytestring, http-media, http-types, interpolate, purescheme-wai-routing-core, text, wai, warp [details]
License Apache-2.0
Copyright 2020 Fernando Rincon Martin
Author Fernando Rincon Martin
Maintainer f.rincon@protonmail.com
Category Web
Home page https://github.com/purescheme/purescheme-wai-routing-core#readme
Bug tracker https://github.com/purescheme/purescheme-wai-routing-core/issues
Source repo head: git clone https://github.com/purescheme/purescheme-wai-routing-core
Uploaded by frincon at 2020-01-30T12:17:08Z

Modules

[Index] [Quick Jump]

Flags

Manual Flags

NameDescriptionDefault
development

Used while development

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for purescheme-wai-routing-core-0.1.0.0

[back to package description]

purescheme-wai-routing-core

Build Status

The goal of purescheme is make a simple framework for building fast microservices in haskell.

This module provides simple routing functions for create rest APIs on top of a WAI server.

Getting Started

Minimal Example to run a helloworld using Warp server:

{-# LANGUAGE OverloadedStrings #-}
module Main where

import Network.Wai.Routing.Purescheme.Core

import Network.HTTP.Types (status200, StdMethod(..), hContentType)
import Network.Wai.Handler.Warp (run)
import Network.Wai (responseLBS, Application)

main :: IO ()
main = run 8080 api

api :: Application
api = path "hello"
            $ method GET
            $ complete
            $ responseLBS status200 [(hContentType, "text/html")] "<h1>Hellow World!</h1>"

Overview

This module provides simple routing functions that works on top of "Network.Wai" applications.

The basic idea is provides functions that modifies an @"Application" in order to match certain rules. It is inspired on akka http server Routing DSL.

User Guide

The API is divided in several modules by its functionality:

A complete example can be found in the app folder.

Why

There are many routing frameworks for Haskell but they usually are:

So, as Haskell is totally functional, and, based on the simplicity of an Wai Application (which is basically a function that converts requests to responses, why not create functions on top of Wai Application that provides a functional way to implement RESTful APIs?

Status

Currently the API is totally functionalm but the status is considered Alpha. That means, the whole API can change in further release until we reach the beta status.

Feedback are welcome!

Please, if you feel that some functionallity is missing or something can be improve, post a issue!