播放2 - 路由到index.html

时间:2016-12-01 21:24:57

标签: scala angular playframework-2.0 angular-cli

有没有办法路由GET" /"在路由文件中请求,所以它将提供index.html,它在默认视图/ index.scala.html之外的其他目录中?在我的情况下,我想提供public / main / index.html文件(因为使用angular2和angular-cli)

2 个答案:

答案 0 :(得分:1)

来自文档(https://www.playframework.com/documentation/2.5.x/AssetsOverview#The-Assets-controller):

  

要路由到单个静态文件,路径和文件都必须是   指定:

GET  /favicon.ico        controllers.Assets.at(path="/public", file="favicon.ico")

所以你的情况可能如下:

GET  /        controllers.Assets.at(path="/public", file="main/index.html")

答案 1 :(得分:0)

在您的网络服务器中,只需将所有HTML请求提供给index.html

相关问题