This module should be removed when web-routes incorporates necessary support.
- encodePathInfo :: [String] -> [(String, String)] -> String
- data Site url a = Site {
- handleSite :: (url -> [(String, String)] -> String) -> url -> a
- formatPathSegments :: url -> ([String], [(String, String)])
- parsePathSegments :: [String] -> Either String url
Documentation
encodePathInfo :: [String] -> [(String, String)] -> String
Encodes a list of path segments into a valid URL fragment.
This function takes the following three steps:
- UTF-8 encodes the characters.
- Performs percent encoding on all unreserved characters, as well as :@=+$,
- Intercalates with a slash.
For example:
encodePathInfo [\"foo\", \"bar\", \"baz\"]
"foo/bar/baz"
encodePathInfo [\"foo bar\", \"baz\/bin\"]
"foo%20bar/baz%2Fbin"
encodePathInfo [\"\"]
"%D7%A9%D7%9C%D7%95%D7%9D"
data Site url a
A site groups together the three functions necesary to make an application:
- A function to convert from the URL type to path segments.
- A function to convert from path segments to the URL, if possible.
- A function to return the application for a given URL.
There are two type parameters for Site: the first is the URL datatype, the second is the application datatype. The application datatype will depend upon your server backend.
Site | |
|