I\'m trying to make a route to a specific static file but everything I\'m trying ends with an error.
I\'ve made 3 different attempts:
1.
GET /fil
This ability still haven't been added, as I know. But if someone needs answer, as an option, helper controller can be created for these purpose:
object StaticFile extends Controller {
def html(file: String) = Action {
var f = new File(file)
if (f.exists())
Ok(scala.io.Source.fromFile(f.getCanonicalPath()).mkString).as("text/html");
else
NotFound
}
}
and then in routes config
GET / controllers.StaticFile.html(file = "public/index.html")