Reputation: 942
I want to open an HTML file in the browser. All documentation/answers online suggest that the following is what I should have in my routes file:
GET /test controllers.Assets.at(path="/public/html", file="test.html")
Where test.html
is located in public/html
. However, when I go to /test
, test.html
is downloaded when I want it to just open in the browser (which I think is the expected behaviour of the .at
function).
This has only started happening recently and no changes have been made to routes file or html file.
Any idea what might be causing this?
Upvotes: 0
Views: 149
Reputation: 1799
To serve an HTML file, you should have a Result. Results are defined within the controllers. For example:
def example = Action {OK(views.html.myhtml)}
Looks for the file myhtml.scala.html
within the views
folder. And here the controller method serves the result ok
(http status 200) with that html file.
The asset folder is for ... well asset files which then can be used within the webpages: javascript/css/image files.
Upvotes: 1