nightograph
nightograph

Reputation: 2249

is it possible for playframework 2 module to have its own route file and controllers?

I'm not exactly sure if what I'm trying to do is achievable by playframework 2 or not so I appreciate any help.

Basically I want to have a set up api as the "core project api" and have a different set of api as play module. I want to deploy the main project on any server and when I want to, include/add "the module" to support additional functionality.

for example, I want the main project to support

GET    /getUserInfo  controllers.ApplicationApi.getUserInfo() 

and after I include the module, it be able to support

GET    /getCustomizedUserInfo      controllers.customized.ApplicationApi.getCustomizedUserInfo()

so basically I need the module to be able to have its own additional route file and controller.

Is this possible in playframework 2? from limited information provided in playframework2 documents, I'm not sure if we can have an additional route file and a controller in a playframework module.

thanks so much for the help.

Upvotes: 0

Views: 643

Answers (2)

akauppi
akauppi

Reputation: 18056

Here are some recent pointers that someone might find useful on this:

Both of these have the subprojects within the same git repo. But sbt is able to access projects also from other repositories, so making the relationships fully modular isn't that hard. I've done that using Maven in between, so ask for more details if needed.

Upvotes: 1

adis
adis

Reputation: 5951

Play Framework supports modules and subprojects. They are really close to each other, and I my point of view, no difference, they both can be regular Play applications or regular SBT projects (just as the Play Framework itself exists of several modules). Correct me if I am wrong here.

But, modules can have their on routes, it is described in the manuals: https://github.com/playframework/Play20/wiki/SBTSubProjects

I had a question about it as well: How to create sub projects in Play Framework? (play#play-java_2.9.2;2.1-RC3: not found)

Upvotes: 2

Related Questions