At the end of the file of my routes, I placed the entire route to catch requests that were not previously detected, and send them to my own router (for further processing):
GET /*nameUrl controllers.Application.router(nameUrl: String)
Of course, there are many other routes BEFORE this line. The big surprise for me is that everyone will catch every time, even if the previous route is also called, so if I open the address domain.tld/test , it displays me both logs in the Test action hit! console Test action hit! And Custom router hit! There is a simplified example:
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 I want to get:
I want to get the url for articles with my router, i.e. domain.tld/category_1/article_title without a prefix in front of it, of course, if I change, I catch everything for something stable, it will no longer receive double hits:
GET /news/*nameUrl controllers.Application.router(nameUrl: String) domain.tld/news/category_1/article_title
however, I really want to avoid the /news/ segment. Is it possible?
biesior
source share