Any way to split conf/routes into several files?

2598 views
Skip to first unread message

Todd O'Bryan

unread,
Jun 11, 2012, 6:45:08 PM6/11/12
to play-fr...@googlegroups.com
Is there a way to split routes into several files, maybe based on the
prefix of the URL?

My team and I are working on several interconnected pieces, but feel
like we're stepping on each other's toes trying to edit one big file
and would be happier if we could assign a prefix to each subgroup.

Or maybe we should be creating separate modules? Except that the
documentation I read said not to create routes files for your modules.

Or is there some easier way to split things into subprojects?

Todd

Xuefeng Wu

unread,
Jun 11, 2012, 11:07:14 PM6/11/12
to play-fr...@googlegroups.com
2.1 will support multiple routers in sub project.

在 2012年6月12日星期二UTC+8上午6时45分08秒,Todd O'Bryan写道:

Todd O'Bryan

unread,
Jun 12, 2012, 11:02:38 AM6/12/12
to play-fr...@googlegroups.com
Excellent. I'll just suffer for a bit and wait for the upgrade.
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/GH9rG1vX6joJ.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.

peter hausel

unread,
Jun 12, 2012, 11:18:51 AM6/12/12
to play-fr...@googlegroups.com
Please see this* link for more information


On Tuesday, June 12, 2012 11:02:38 AM UTC-4, Todd O'Bryan wrote:
Excellent. I'll just suffer for a bit and wait for the upgrade.

On Mon, Jun 11, 2012 at 11:07 PM, Xuefeng Wu <ben...@gmail.com> wrote:
> 2.1 will support multiple routers in sub project.
>
> 在 2012年6月12日星期二UTC+8上午6时45分08秒,Todd O'Bryan写道:
>>
>> Is there a way to split routes into several files, maybe based on the
>> prefix of the URL?
>>
>> My team and I are working on several interconnected pieces, but feel
>> like we're stepping on each other's toes trying to edit one big file
>> and would be happier if we could assign a prefix to each subgroup.
>>
>> Or maybe we should be creating separate modules? Except that the
>> documentation I read said not to create routes files for your modules.
>>
>> Or is there some easier way to split things into subprojects?
>>
>> Todd
>
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/GH9rG1vX6joJ.
> To post to this group, send email to play-framework@googlegroups.com.
> To unsubscribe from this group, send email to

DanInDC

unread,
Jun 12, 2012, 12:06:39 PM6/12/12
to play-framework
Are you using any sort of version control? You shouldn't have feet
stepping issues if you are...

Joe Wyrembelski

unread,
Dec 5, 2012, 7:59:33 AM12/5/12
to play-fr...@googlegroups.com
Is your suffering over? 

I'm testing a sub-project setup where each sub-project has their own routes file but it doesn't seem to be working.  Did you find the documentation on how it needs to be setup to work? 


On Tuesday, June 12, 2012 11:02:38 AM UTC-4, Todd O'Bryan wrote:

peter hausel

unread,
Dec 5, 2012, 10:35:20 AM12/5/12
to play-fr...@googlegroups.com

Zoro

unread,
Mar 23, 2014, 9:37:43 AM3/23/14
to play-fr...@googlegroups.com
Yes, you can use the following syntax inside conf/routes

-> / another.Routes

Now, your file, located inside conf directory will be included ( conf/another.routes )

Here you can reading more details

http://www.playframework.com/documentation/2.2.x/SBTSubProjects

see
Splitting the route file section

Ciaran Fisher

unread,
Jul 24, 2014, 6:35:26 AM7/24/14
to play-fr...@googlegroups.com
Hi Zoro,

Can you elaborate on this?

My App is Play 2.3 and all i want is to split the routes over multiple files without using sub projects / modules as the number of routes is becoming unmanageable

If -> / another.Routes worked, that would be perfect but it doesn't.

Error when i try to include a secondary route file:
[error] PlayApp/conf/routes:292: not found: value routes2
[error] -> / routes2.Routes

Do i need to add that second route file to my built.sbt some how?

Fernando Correia

unread,
Jul 24, 2014, 8:12:49 AM7/24/14
to play-fr...@googlegroups.com
You can split the route files like this, for example:

File "routes":

->      /api                        api.Routes
->      /                           website.Routes

File "api.routes":

GET    /healthCheck/status                              api.controllers.HealthCheck.status
GET    /healthCheck/version                             api.controllers.HealthCheck.version

file "website.routes":

GET    /                         controllers.Home.index
GET    /robots.txt               controllers.Assets.at(path="/public", file="robots.txt")
GET    /assets/*file             controllers.Assets.at(path="/public", file)
GET    /profile                  controllers.Users.profile

Ciaran Fisher

unread,
Jul 24, 2014, 12:42:27 PM7/24/14
to play-fr...@googlegroups.com
Ah thanks! 

Didn't realise the second file needed to be called something.routes to work!

-- 

Ciaran Fisher
CTO
TribeHive



--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/dxDRml0khdY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages