{-# LANGUAGE
    OverloadedStrings
  , ScopedTypeVariables
  , FlexibleContexts
  , DataKinds
  #-}

module Routes where

import Imports
import Handlers
import qualified Data.Text as T



routes :: HandlerT (MiddlewareT AppM) sec AppM ()
routes = do
  matchHere (action homeHandle)
  matchGroup (l_ "packages" </> o_) $ do
    matchHere allPackagesHandle
    match (wordChunk </> o_) packagesHandle
    match (l_ "search" </> wordChunk </> o_)
      browseSearchHandle
  matchGroup (l_ "people" </> o_) $ do
    match (l_ "search" </> wordChunk </> o_)
      peopleSearchHandle
    match (l_ "view" </> wordChunk </> o_)
      peopleViewHandle
  matchGroup (l_ "login" </> o_) $ do
    matchHere loginHandle
    match (l_ "facebook" </> o_)
      loginFacebookHandle
  matchGroup (l_ "session" </> o_) $
    matchHere sessionHandle
  matchAny (action notFoundHandle)
