路线与资源
Route vs. Resource
在 Yesod 书中,它在第 I 部分的状态。基础知识,第 3 章。基础知识,Section Routing(第二版):
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.
这只是措辞问题,我知道,但我想了解 HomeR
是 route 还是 resource.
(请不要说 "both")。
我的理解是基于 this Yesod documentation page。
路线/ HomeR GET
由
组成
- 资源模式
/
- 资源名称
HomeR
GET
处理程序
据我所知,每个路由的资源名称都是唯一的,因此文档采用了将 "the route with resource name X
" 引用为 "the route X
" 的快捷方式。
所以答案是:HomeR
是资源,HomeR
是资源名称为HomeR
的路由。 (换句话说,两者)。
在 Yesod 书中,它在第 I 部分的状态。基础知识,第 3 章。基础知识,Section Routing(第二版):
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]
In other words, the preceding code simply creates a route [...] called
HomeR
. [...]. We callHomeR
a resource, which is where the R suffix comes from.
这只是措辞问题,我知道,但我想了解 HomeR
是 route 还是 resource.
(请不要说 "both")。
我的理解是基于 this Yesod documentation page。
路线/ HomeR GET
由
- 资源模式
/
- 资源名称
HomeR
GET
处理程序
据我所知,每个路由的资源名称都是唯一的,因此文档采用了将 "the route with resource name X
" 引用为 "the route X
" 的快捷方式。
所以答案是:HomeR
是资源,HomeR
是资源名称为HomeR
的路由。 (换句话说,两者)。