The wai-cors package

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]

This package provides an implemenation of Cross-Origin resource sharing (CORS) for Wai that aims to be compliant with http://www.w3.org/TR/cors.


[Skip to ReadMe]

Properties

Versions0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.4, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5
Change logCHANGELOG.md
Dependenciesattoparsec (>=0.10.4.0), base (==4.*), base-unicode-symbols (>=0.2.2.3), bytestring (>=0.10.0.2), case-insensitive (>=1.0.0.1), charset (>=0.3.7), errors (>=1.4.1), http-types (>=0.8.0), parsers (>=0.11), resourcet (>=0.4), transformers (>=0.3), wai (>=1.4.0) [details]
LicenseMIT
CopyrightCopyright (c) 2014 AlephCloud Systems, Inc.
AuthorLars Kuhtz <lars@alephcloud.com>
MaintainerLars Kuhtz <lars@alephcloud.com>
CategoryWeb
Home pagehttps://github.com/alephcloud/wai-cors
Bug trackerhttps://github.com/alephcloud/wai-cors/issues
Source repositoryhead: git clone https://github.com/alephcloud/wai-cors
this: git clone https://github.com/alephcloud/wai-cors(tag 0.1.4)
UploadedSat Jun 21 09:26:48 UTC 2014 by larsk

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for wai-cors-0.1.4

[back to package description]

Build Status

Cross-Origin Resource Sharing (CORS) For Wai

This package provides a Haskell implemenation of CORS for WAI that aims to be compliant with http://www.w3.org/TR/cors.

Usage

The file test/server.hs shows how to support simple cross-origin requests (as defined in http://www.w3.org/TR/cors) in a scotty application.

{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE OverloadedStrings #-}

module Main
( main
) where

import Network.Wai.Middleware.Cors
import Web.Scotty

main ∷ IO ()
main = scotty 8080 $ do
    middleware simpleCors
    matchAny  "/" $ text "Success"

Documentation for more general usage can be found in the module Network.Wai.Middleware.Cors.

TEST

Currently there is only basic support to test simple cross-origin request from a browser.

Start server:

cd test
runHaskell server.hs

Open the file test/index.html in a modern web-browser in order to run some simple tests.