播放 2 - 路由到 index.html
Play 2 - routing to index.html
有什么方法可以在路由文件中路由 GET“/”请求,以便它可以服务 index.html,它位于默认 views/index.scala.html 以外的其他目录中?就我而言,我想提供 public/main/index.html 文件(因为使用 angular2 和 angular-cli)
在您的网络服务器中,只需要满足所有 HTML 请求即可 index.html
来自文档 (https://www.playframework.com/documentation/2.5.x/AssetsOverview#The-Assets-controller):
To route to a single static file, both the path and file has to be
specified:
GET /favicon.ico controllers.Assets.at(path="/public", file="favicon.ico")
因此您的情况可能如下所示:
GET / controllers.Assets.at(path="/public", file="main/index.html")
有什么方法可以在路由文件中路由 GET“/”请求,以便它可以服务 index.html,它位于默认 views/index.scala.html 以外的其他目录中?就我而言,我想提供 public/main/index.html 文件(因为使用 angular2 和 angular-cli)
在您的网络服务器中,只需要满足所有 HTML 请求即可 index.html
来自文档 (https://www.playframework.com/documentation/2.5.x/AssetsOverview#The-Assets-controller):
To route to a single static file, both the path and file has to be specified:
GET /favicon.ico controllers.Assets.at(path="/public", file="favicon.ico")
因此您的情况可能如下所示:
GET / controllers.Assets.at(path="/public", file="main/index.html")