Created
February 8, 2017 20:50
-
-
Save jklydev/7b92bd6892a22fd2c8150b5bbe1419ba to your computer and use it in GitHub Desktop.
cors.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Network.HTTP.Simple | |
import Web.Scotty | |
import Data.Monoid (mconcat) | |
import Network.Wai.Middleware.Cors | |
main = scotty 3000 $ do | |
middleware simpleCors | |
get "/" $ html "hi" | |
get "/thing/" $ file "./thing.html" | |
-- curl -i http://127.0.0.1:3000 -H 'Origin: 127.0.0.1' -v | |
-- Will show " Access-Control-Allow-Origin: * " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment