Created
April 19, 2015 08:43
-
-
Save dbushenko/9c2c0c4df8e8c850af8a to your computer and use it in GitHub Desktop.
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 Data.Default (def) | |
import Web.Scotty | |
import Data.Monoid (mconcat) | |
import Network.Wai.Middleware.Static | |
import Network.Wai.Middleware.RequestLogger (logStdoutDev) | |
import Network.Wai.Session (withSession, Session) | |
import Network.Wai.Session.Map (mapStore_) | |
import Data.String | |
import qualified Data.Vault.Lazy as Vault | |
import Control.Monad.IO.Class | |
import Control.Monad | |
import qualified Data.ByteString.Char8 as BS | |
main = do | |
session <- Vault.newKey | |
store <- mapStore_ | |
scotty 3000 $ do | |
middleware $ staticPolicy (noDots >-> addBase "static") | |
middleware logStdoutDev | |
middleware $ withSession store (fromString "SESSION") def session | |
get "/:word" $ do | |
beam <- param "word" | |
html $ mconcat ["<h1>Scotty, ", beam, " me up!</h1>"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment