1. Luke Plant
  2. haskellblog

Commits

Luke Plant  committed d8c16e6

Added view that redirects from 'posts/'

  • Participants
  • Parent commits 33dcb28
  • Branches default

Comments (0)

Files changed (2)

File src/Blog/Routes.hs

View file
  • Ignore whitespace
 
 indexRoute         = empty
 postRoute          = "posts/" <+/> stringParam
+postsRedirect      = "posts/" <+/> empty
 categoriesRoute    = "categories/" <+/> empty
 categoryRoute      = "categories/" <+/> stringParam
 debugRoute         = "debug/" <+/> stringParam
 
 routes = [ indexRoute        //-> mainIndex
          , postRoute         //-> postView
+         , postsRedirect     //-> postsRedirectView
          , categoriesRoute   //-> categoriesView
          , categoryRoute     //-> categoryView
          , debugRoute        //-> debug

File src/Blog/Views.hs

View file
  • Ignore whitespace
 import Web.Utils (addHtml)
 import Web.GenUtils (utf8)
 import Blog.Templates
+import Blog.Links
 
 standardResponse html = buildResponse [
                          addHtml html
                  , addContent $ utf8 $ show req
                  ] utf8TextResponse
 
+postsRedirectView req = return $ Just $ redirectResponse indexLink :: IO (Maybe Response)
 
 -- TODO
 
 categoriesView = dummyView
 categoryView slug = dummyView
 postView slug = dummyView
+