Make Module To Be Default Handler

I’m creating a simple shipping cart module where I would like the module to be the defaultEvent within an application. What I did in the ColdBox.cfc for defaultEvent is to set “[module entry point]:event:action”.
However, I’ve been reading about routing in ColdBox and would like some recommendation on how to utilize route to make the module the default event:action within an application.
For example, how would I force ColdBox the following URL to default to a Module event:action -

Also, how would I write the routing for the following example?[category description]/[production name]/

Not sure if the above example is possible using Routing alone.

I think I figured out my first question in reference to defaulting to the module default event.
In ColdBox.cfc I set the defaultEvent="";
Then in ModuleConfig.cfc I set the this.entryPoint = “/” and added the following in routes - {pattern="/", handler=“Home”, action=“index”}

The next issue I’m having problem is when I do the following -[category description]
I added the following in the ModuleConfig.cfc for the routes but I still keep getting not a valid registered event error.

{pattern="/categories/:category_desc", handler=“Search”, action=“index”},

Any ideas what I’m doing wrong?


You can look at how ContentBox does this to get a lot of help. Check out the ModuleConfig.cfc in the contentbox-ui module.

Also here are the docs for module routes:

In your error you mentioned, what event is it looking for?



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform:

Thank you. The code from ContentBox pointed me in the right direction. It was appending addRoute to force the module to take over the application while adding a prefix to the parent application.