[Coldbox 4.1.0] Sample app for Modules

Hi

Is there a sample application to demonstrate how to set up and use Modules?

In particular, I’m unsure about where do I register and activate modules. In the manual under “Loading New Modules” it says this:

Call registerAndActivateModule(moduleName,[instantiationPath]) to register and activate the module

But where do I call this? In the main controller? In the Coldbox.cfc config, in Wirebox.cfc?

Cheers
Nick

Hi Nick,

Module can be placed in “modules” or “modules_app” folder

ColdBox module docs will help you in understanding and implemenation

http://coldbox.ortusbooks.com/content/?q=module

coldbox Relax module with coldbox-app

https://github.com/coldbox-modules/coldbox-relax

You typically don’t need to do anything other than place the module in your modules folder. ColdBox will look there by convention and load all the modules it finds. You only need to use the ModuleService methods if you want to do funky dynamic loading and unloading of modules at runtime.

Also, Sana mentioned the modules_app folder. That is a new convention in the latest versions of ColdBox.

  • /modules is for modules that are managed by CommandBox and not committed to source control (like 3rd party modules)
  • /modules_app is for custom modules that you create purely for organizing your app that you want to commit with the rest of the code.
    Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

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

Ok thanks Brad.

Brad - where can I see more info on /modules_app? I am unfamiliar with that? If we don’t use Commandbox at all do we need to be concerned with it? Which CB version is it relevant?

Thanks!