Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Route vs. Resource

Tags:

haskell

yesod

In the Yesod book it is state at Part I. Basics, Chapter 3. Basics, Section Routing (Second Edition):

mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]

In other words, the preceding code simply creates a route [...] called HomeR. [...]. We call HomeR a resource, which is where the R suffix comes from.

This is just about wording, I know, but I would like to understand if HomeR is a route or a resource. (please don't say "both").

like image 569
nemron Avatar asked Nov 07 '22 17:11

nemron


1 Answers

My understanding is based off this Yesod documentation page.

The route / HomeR GET is made up of

  1. the resource pattern /
  2. the resource name HomeR
  3. the GET handler

As far as I can tell, the resource name is unique to each route, so the documentation takes the shortcut of referring to "the route with resource name X" as "the route X".

So the answer is: HomeR is a resource, and HomeR is the route with resource name HomeR. (Both, in other words).

like image 53
Isaac van Bakel Avatar answered Nov 15 '22 04:11

Isaac van Bakel