如何在 Scala 中创建子路由文件以及如何访问该路由?

How to create the Sub route file in scala and how to access that route?

有什么方法可以创建子路由文件并告诉我如何访问它。

在您的 routes 主文件中,您可以添加如下一行:

/foo -> foo.Routes

如果您随后添加具有以下内容的 foo.routes 文件:

/bar/:id controllers.Application.bar(id)

然后所有 /foo/bar/:id URI 将被路由到 controllers.Application.bar 函数。

在您的 conf 文件中创建新的 admin.Route

conf/routes:

GET /index                  controllers.HomeController.index()

->  /admin admin.Routes

GET     /assets/*file       controllers.Assets.at(path="/public", file)
modules/admin/conf/admin.routes:

GET /index                  controllers.admin.HomeController.index()

GET /assets/*file           controllers.Assets.at(path="/public/lib/myadmin", file)

请试试这个link SBTSubProjects