playframework 2.0 - Wildcard Routing to static file in Play 2 -


i working on play framework 2.2 application serves both json api , single-page application. single-page app, using backbone.js, , support html5 history api.

currently, play serving single-page app via index.html file, , routing in single-page app done hash-based routing. below route using:

get   /app/*file   controllers.assets.at(path="/public/app/src", file) 

and sample url handled single-page app is:

/app/index.html#/some/url 

i able route all urls begin /app/ index.html file, above url become following , still handled index.html file:

/app/some/url 

my idea use route following:

get   /app/*anything   controllers.assets.at(path="/public/app/src", file="index.html") 

however, play not happy me not using "anything" route, following compilation error: missing parameter in call definition: anything.

is there way in play 2 have "wildcard" route 1 above route single, static file?

this limitation in play, 1 that's easy work around. define action delegates assets controller , accepts parameter ignores:

def index(path: string) = controllers.assets.at(path="/public/app/src", file="index.html") 

then point route @ that.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -