RE: [coldbox:15527] [coldbox-3.5.1] Routes by database

routes.cfm is a ColdFusion file, so you can make it as dynamic as you want. You could pull them from a database, and loop over them to set them. Just remember though that routes.cfm is processed once at application startup. If they change, you’ll need to reinit. There may be a way to update them on the fly, but I’ve never tried it.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Heh…that’s funny…the simplest perspective escapes me sometimes…its just a cfm template…not magic.

Noted :slight_smile:

But at the time routes is loaded, would I have wirebox / model access from the framework? Other frameworks have messed with me in the past by putting cart before horse and inhibiting me from automating some features.

Mike

1 - Perform Query
2 - Loop over Query calling addRoute()
3 - Be happy

Just remember, order is important when routes are registered!

There should be little need to change routes. Don’t forget, you can have variables in your routes with :notation and :optionaNotation?.

True and I forget about the the variable notations…databased building may not be the way I need to go…but this research is killing me and I wanted to be as thorough as possible.

I can’t see any real benefit in having the routes in the db – (Aaron, correct me if I’m wrong, but) the site would need a reinit regardless of whether routes were added via routes.cfm or from addRoute()…

well if you have to reinit on addRoute then no…there is really no benefit. If anyone is brave enough to respond to my other post regarding SaaS and modules, reiniting is something I want to avoid.

That is correct. A reinit would absolutely be required, regardless of where the routes are stored.

No reinit would be required.

If you talk tithe ses interceptor and you call addroute on it it will dynamically compile the route an add it to the routin maps.

You can also remove routes, namespaces, modules etc. just get a reference to the interceptor.

I have apps that manage the routes in the db.

Amazing…particularly the part about modules being changed without a reinit.

Thanks.

Oops. :slight_smile: