Can a Module provide custom routes ?

23 views
Skip to first unread message

Gervais Blaise

unread,
Jul 3, 2019, 9:57:23 AM7/3/19
to Play Framework [deprecated]
Hello there,

We have a multi-module project that we would like to extend with modules. The idea is to add some modules to the classpath and activate them via `play.modules.enabled` I made some successful tests.
But I would like to allow those modules to extends the router and, sadly, I cannot find anything about that. I saw in this discussion[1] that the sird router should be the best option however I don't see how to dynamically add routes to the default router (routes.conf) ?

So, can a Module provide custom routes configure at runtime, during the binding ?





Gervais Blaise

unread,
Jul 4, 2019, 3:37:09 AM7/4/19
to Play Framework [deprecated]
In case of, here is the question on the non deprecated forum : https://discuss.lightbend.com/t/can-a-module-provide-custom-routes/4538

juan....@reduc.edu.cu

unread,
Jul 4, 2019, 7:45:26 PM7/4/19
to play-fr...@googlegroups.com
> In case of, here is the question on the non deprecated forum :
> https://discuss.lightbend.com/t/can-a-module-provide-custom-routes/4538
>

Hi. Yes, it can. Look at the CRUD module's source code for an example.

Regards,
Juan Carlos

---Universidad de Camaguey "Ignacio Agramonte Loynaz", Cuba http://www.reduc.edu.cu/

Gervais Blaise

unread,
Jul 5, 2019, 2:10:38 AM7/5/19
to Play Framework [deprecated]
Hello Juan, 

Thanks for your response. In the meantime, I was able to build something (https://discuss.lightbend.com/t/can-a-module-provide-custom-routes/4538/2).
But I would be interested to see how it is done in the "CRUD module". Do you have a link ?


Thanks

juan....@reduc.edu.cu

unread,
Jul 5, 2019, 2:09:31 PM7/5/19
to play-fr...@googlegroups.com
Hello Gervais.

I meant the CRUD module from the Play! Framework 1.x series (because of
the [deprecated] tag in the thread). It is included in the distribution
packages, you can donwload the latest from [1]. Once you extract it, look
into modules/crud/conf/routes. See the Play! documentation [2] for an
explanation of how to include those routes in your application. The Secure
module provides its own routes too by the way.

Regards,
Juan Carlos

[1] https://downloads.typesafe.com/play/1.5.3/play-1.5.3.zip
[2] https://www.playframework.com/documentation/1.5.x/modules#routes
> --
> Please join our new forum at https://discuss.playframework.com!
> The play-framework Google Group will soon be put into read-only mode.
> For details, see
> https://blog.playframework.com/introducing-discuss-playframework-com/.
> ---
> You received this message because you are subscribed to the Google Groups
> "Play Framework [deprecated]" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to play-framewor...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/play-framework/a7d37759-bf42-4f84-8d50-9df755e6fa30%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages