At the end of my routes file I put a catch-all route to catch requests which wasn't catch previously and pass it to my own router (for further processing):
GET /*nameUrl controllers.Application.router(nameUrl: String)
of course there are many other routes BEFORE that line. The big surprise for me is that the catch-all is hitten every time, even if previous route is hitten as well, so if I'm opening address domain.tld/test
it displays me both logs in the console Test action hit!
AND Custom router hit!
. There is a simplified sample:
public static Result test() {
Logger.debug("Test action hit!");
return ok();
}
public static Result router(String nameUrl) {
Logger.debug("Custom router hit!");
return ok();
}
Routes (in this order)
GET /test controllers.Application.test
GET /*nameUrl controllers.Application.router(nameUrl: String)
What do I want to get:
I want to get url's for articles with my router ie domain.tld/category_1/article_title
without any prefix before it, of course if I change catch all to something stable it won't get double hits anymore:
GET /news/*nameUrl controllers.Application.router(nameUrl: String)
domain.tld/news/category_1/article_title
however I really want to avoid /news/
segment. Is that possible?