3 changed files with 61 additions and 0 deletions
@ -0,0 +1,30 @@ |
|||||
|
Name: riotblog |
||||
|
Version: 0.1 |
||||
|
Synopsis: Project Synopsis Here |
||||
|
Description: Project Description Here |
||||
|
License: AllRightsReserved |
||||
|
Author: Author |
||||
|
Maintainer: maintainer@example.com |
||||
|
Stability: Experimental |
||||
|
Category: Web |
||||
|
Build-type: Simple |
||||
|
Cabal-version: >=1.2 |
||||
|
|
||||
|
Executable riotblog |
||||
|
hs-source-dirs: src |
||||
|
main-is: Main.hs |
||||
|
|
||||
|
Build-depends: |
||||
|
base >= 4 && < 5, |
||||
|
bytestring >= 0.9.1 && < 0.11, |
||||
|
monad-control >= 1.0 && < 1.1, |
||||
|
mtl >= 2 && < 3, |
||||
|
snap-core >= 1.0 && < 1.1, |
||||
|
snap-server >= 1.0 && < 1.1, |
||||
|
ginger |
||||
|
|
||||
|
if impl(ghc >= 6.12.0) |
||||
|
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2 |
||||
|
-fno-warn-unused-do-bind |
||||
|
else |
||||
|
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2 |
@ -0,0 +1,24 @@ |
|||||
|
{-# LANGUAGE OverloadedStrings #-} |
||||
|
module Main where |
||||
|
|
||||
|
import Control.Applicative |
||||
|
import Snap.Core |
||||
|
import Snap.Util.FileServe |
||||
|
import Snap.Http.Server |
||||
|
|
||||
|
main :: IO () |
||||
|
main = quickHttpServe site |
||||
|
|
||||
|
site :: Snap () |
||||
|
site = |
||||
|
ifTop (writeBS "Hello, world! Hey Hey Hey") <|> |
||||
|
route [ ("foo", writeBS "bar") |
||||
|
, ("echo/:echoparam", echoHandler) |
||||
|
] <|> |
||||
|
dir "static" (serveDirectory ".") |
||||
|
|
||||
|
echoHandler :: Snap () |
||||
|
echoHandler = do |
||||
|
param <- getParam "echoparam" |
||||
|
maybe (writeBS "must specify echo/param in URL") |
||||
|
writeBS param |
@ -0,0 +1,7 @@ |
|||||
|
flags: {} |
||||
|
extra-package-dbs: [] |
||||
|
packages: |
||||
|
- '.' |
||||
|
extra-deps: |
||||
|
- ginger-0.3.7.2 |
||||
|
resolver: lts-7.12 |
Loading…
Reference in new issue