File: options.hs

package info (click to toggle)
haskell-scotty 0.20.1%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 256 kB
  • sloc: haskell: 1,786; makefile: 6
file content (21 lines) | stat: -rw-r--r-- 572 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where

import Web.Scotty

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

import Network.Wai.Handler.Warp (setPort)

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

-- 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"