File: options.hs

package info (click to toggle)
haskell-scotty 0.11.6%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 232 kB
  • sloc: haskell: 1,369; makefile: 6
file content (22 lines) | stat: -rwxr-xr-x 560 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where

import Web.Scotty

import Network.Wai.Middleware.RequestLogger -- install wai-extra if you don't have this

import Data.Default.Class (def)
import Network.Wai.Handler.Warp (setPort)

-- Set some Scotty settings
opts :: Options
opts = def { verbose = 0
           , settings = setPort 4000 $ settings def
           }

-- This won't display anything at startup, and will listen on localhost:4000
main :: IO ()
main = scottyOpts opts $ do
    middleware logStdoutDev

    get "/" $ text "hello world"