我正在尝试创建到特定静态文件的路由,但我尝试的所有内容都以错误结束。
我做了3种不同的尝试:
1.
GET /file staticFile:/public/html/file.html
我得到的错误:
Compilation error
string matching regex `\z' expected but `:' found
2.
GET /file controllers.Assets.at(path="/public/html", "file.html")
我得到的错误:
Compilation error
Identifier expected
3.
GET /file controllers.Assets.at(path="/public/html", file="file.html")
我得到的错误:(这是最奇怪的)
Compilation error
not enough arguments for method at: (path: String, file: String)play.api.mvc.Call. Unspecified value parameter file.
关于第三个错误的奇怪部分是它在以下行的不同文件(app/views/main.scala.html)中抛出:
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
所有这些方法都可以在 stackoverflow 上的官方文档和/或线程中找到。我在这里想念什么?
谢谢。