Commits

Luke Plant  committed d142efb

Added docs for processors

  • Participants
  • Parent commits 1a16389

Comments (0)

Files changed (1)

File src/Web/Processors/General.hs

 import Web.Request
 import Web.Response
 
--- TODO -- need to include query string, and think about how to handle
+-- ** View processors
+
+--  These take a view function and return a view function.
+--  Alternatively, take a view function and a request and return an IO
+--  (Maybe Response).  This allows them to do both request
+--  pre-processing and response post-processing.  They will be usually
+--  be used as \'decorators\' when defining routes.
+
+-- ** View functions
+
+--  These are straightforward view functions which happen to work as a
+--  kind of pre-handler.  They are installed using routes, usually
+--  before all the others.  These usually do redirects, for example
+--  addSlashRedirectProcessor
+
+-- ** Response processors
+
+--  These take a response and the original request object, and return
+--  a possibly modified response.  This can be useful for
+--  post-processing, or adding headers etc.
+
+
+-- | Returns a responseRedirect if the the request URI does not end
+-- with a slash.  Should be installed before all other routes.
+
+-- TODO
+-- need to include query string, and think about how to handle
 -- POSTs etc
 addSlashRedirectProcessor view req =
     let uri = requestUriRaw req