Saeed Zarinfam
Saeed Zarinfam

Reputation: 10180

Can i define multiple URL for an action in one route in Play Framework 2.x?

I have two route like these:

GET         /admin                       controllers.Application.admin()
GET         /api/admin                   controllers.Application.admin()

can i define somthing like this in Play framework 2?

GET         /admin        /api/admin                  controllers.Application.admin()

Upvotes: 0

Views: 1038

Answers (2)

v_d123
v_d123

Reputation: 27

You can try something like GET /*res controllers.Application.admin(res)

and in controllers you can write def admin(res:String)= { something like this } in scala we do this.

Upvotes: 0

biesior
biesior

Reputation: 55798

No it's not possible, actually the same action shouldn't have two different routes (also from SEO point of view), therefore best practice is creating a redirect from one of them pointing the other one.

Upvotes: 1

Related Questions