Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 79593c2571
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (37 sloc) 1.425 kb
{-# LANGUAGE OverloadedStrings #-}
{-|
This is where all the routes and handlers are defined for your site. The
'site' function combines everything together and is exported by this module.
-}
module Site
( site
) where
import Control.Applicative
import Data.Maybe
import qualified Data.Text.Encoding as T
import Snap.Extension.Heist
import Snap.Extension.Timer
import Snap.Util.FileServe
import Snap.Types
import Text.Templating.Heist
import Application
import Controller.Paste
------------------------------------------------------------------------------
-- | Render recent pastes
pastes :: Application ()
pastes = ifTop $ heistLocal (bindSplices pastesSplices) $ render "pastes"
where
pastesSplices =
[ ("recent-pastes", recentPastesSplice)
, ("possible-languages", possibleLanguagesSplice)
]
------------------------------------------------------------------------------
-- | Render single paste
------------------------------------------------------------------------------
-- | The main entry point handler.
site :: Application ()
site = route [ ("/", methods [GET, HEAD] pastes)
, ("/", method POST addPasteHandler)
--, ("/paste/:pid" singlePaste)
]
<|> serveDirectory "resources/static"
Jump to Line
Something went wrong with that request. Please try again.