One of the stories from the early days of the Web is how search engines wiped out entire
websites. When dynamic web sites were still a new concept, developers didn’t appreciate the
difference between a
POST request. As a result, they created pages—accessed with the
GET method—that would delete pages. When search
engines started crawling these sites, they could wipe out all the content.
If these web developers had followed the HTTP spec properly, this would not have
GET request is supposed to cause no side effects
(you know, like wiping out a site). Recently, there has been a move in web development
to properly embrace Representational State Transfer, also known as REST. This chapter
describes the RESTful features in Yesod and how you can use them to create more robust
In many web frameworks, you write one handler function per resource. In Yesod, the default is to have a separate handler function for each request method. The two most common request methods you will deal with in creating websites are GET and POST. These are the most well-supported methods in HTML, since they are the only ones supported by web forms. However, when creating RESTful APIs, the other methods are very useful.
Technically speaking, you can create whichever request methods you like, but it is strongly recommended to stick to the ones spelled out in the HTTP spec. The most common of these are:
Read-only requests. Assuming no other ...