Skip to content

Instantly share code, notes, and snippets.

@wellercs
Created August 28, 2015 03:58
Show Gist options
  • Save wellercs/b2edc1920973874574b7 to your computer and use it in GitHub Desktop.
Save wellercs/b2edc1920973874574b7 to your computer and use it in GitHub Desktop.
<cfscript>
// inside Application.cfc is service constructor
application.EnterpriseService = new path.to.EnterpriseService();
// inside site code somewhere
application.EnterpriseService.call(api_id=#, custom_args={});
// EnterpriseService.cfc
init() {
// some shared constants set here
// dependent objects needed by multiple services initialized here
}
// this method is single entry/exit point
call() {
// object to init and method to call are dynamically determined
variables.SomeOtherService = new path.to.SomeOtherService();
variables.SomeOtherService.someMethod();
}
// SomeOtherService.cfc
// SomeOtherDAO.cfc
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment