haskellblog / src / Blog / Routes.hs

module Blog.Routes where

import Blog.Views
import Blog.Processors
import Ella.Framework
import Ella.Processors.General (addSlashRedirectView)
import Ella.GenUtils (apply)

-- * Routes

-- These need to be manually synced with Blog.Links

views  = [ addSlashRedirectView
         , canonicalUri
         , empty                                      //-> mainIndex              $ []
         , "atom/" <+/> empty                         //-> allPostsFeedView       $ []
         , "posts/" <+/> anyParam                     //-> postView               $ []
         , "posts/" <+/> stringParam </+> "atom/"     //-> postCommentFeedView    $ []
         , "posts/" <+/> empty                        //-> postsRedirectView      $ []
         , "categories/" <+/> empty                   //-> categoriesView         $ []
         , "categories/" <+/> anyParam                //-> categoryView           $ []
         , "categories/" <+/> stringParam</+>"atom/"  //-> categoryPostsFeedView  $ []
         , "comments/" <+/> empty                     //-> allCommentsView        $ []
         , "comments/atom/" <+/> empty                //-> allCommentsFeedView    $ []
         , "login/" <+/> empty                        //-> loginView              $ []
         , "logout/" <+/> empty                       //-> logoutView             $ []
         , "admin/" <+/> empty                        //-> adminMenu              $ [adminRequired]
         , "admin/category/" <+/> empty               //-> adminCategories        $ [adminRequired]
         , "admin/post/" <+/> empty                   //-> adminPosts             $ [adminRequired]
         , "admin/post/new/" <+/> empty               //-> adminNewPost           $ [adminRequired]
         , "admin/post/edit/" <+/> anyParam           //-> adminEditPost          $ [adminRequired]
         , "admin/ajax/commentvisible/" <+/> empty    //-> adminCommentVisible    $ [adminRequired]
         , "admin/ajax/commentresponse/" <+/> empty   //-> adminCommentResponse   $ [adminRequired]
         , "admin/ajax/commentdelete/" <+/> empty     //-> adminCommentDelete     $ [adminRequired]
         , "admin/ajax/addspamword/" <+/> empty       //-> addSpamWordView        $ [adminRequired]
         , "admin/ajax/deletespamword/" <+/> empty    //-> deleteSpamWordView     $ [adminRequired]
         , "debug/" <+/> anyParam                     //-> debug                  $ []
         ]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.