当前位置: 动力学知识库 > 问答 > 编程问答 >

scala - Can you override routes and make it database driven?

问题描述:

Is it possible to override the default routes file by making it database driven in the playframework?

I want to be able to have routes defined in a more dynamic way instead of hard-coding the routes in a configuration file

网友答案:

Yes it is possible, just create a dynamic route as described in Dynamic parts spanning several / - then in your action divide parts by slash, validate how required and then make your query.

Depending on your DB response you can just call a method which returns a valid Result. That's all

分享给朋友:
您可能感兴趣的文章:
随机阅读: