[英]Play Framework: Arrow (“->”) in routing
Play + Java + CRUD Activator有以下route
文件,我不明白->
做什么。
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
# Home page
GET / controllers.Application.index()
# CRUD Controllers and REST API
-> / play.crud.Routes
在我看來,Play 文檔很差。 我將根據Github上的一個很好的示例進行解釋。
在conf/routes
你可能有:
-> /admin admin.Routes
-> /customer customer.Routes
-> /common common.Routes
然后,例如, admin.Routes
,您可以解決如下:
在Build.sbt
查找admin
的定義:
// Admin Portal
lazy val admin = project.in(file("modules/admin"))
.dependsOn(common)
你看到它在modules/admin
。 前往modules/admin/conf/routes
,您將看到更多路線:
GET /index controllers.admin.Application.getIndex()
因此,Play將其與原始路徑/admin
變為/admin/index
。 也就是說,如果在瀏覽器中顯示/admin/index
,則將使用controllers.admin.Application.getIndex()
來提供此路由。
->
arrow導入外部包play.crud.Routes
定義的路由。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.