### Setup Project and Install Dependencies Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/recipes/building-a-simple-basic-http-authentication-interceptor.md Use CommandBox to create a new ColdBox application, install necessary dependencies like cbStorages, and start the development server. ```bash mkdir simple-auth --cd coldbox create app "SimpleAuth" install cbStorages server start ``` -------------------------------- ### Application.cfc Scheduler Setup Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/promises-async-programming/scheduled-tasks.md This example demonstrates setting up a scheduler within the onApplicationStart function of Application.cfc. It includes registering tasks with different scheduling intervals and failure handlers, and ensures the scheduler is started. ```javascript component{ this.name = "My App"; function onApplicationStart(){ new wirebox.system.Injector(); application.asyncManager = application.wirebox.getInstance( "wirebox.system.async.AsyncManager" ); application.scheduler = application.asyncmanager.newScheduler( "appScheduler" ); /** * -------------------------------------------------------------------------- * Register Scheduled Tasks * -------------------------------------------------------------------------- * You register tasks with the task() method and get back a ColdBoxScheduledTask object * that you can use to register your tasks configurations. */ application.scheduler.task( "Clear Unregistered Users" ) .call( () => application.wirebox.getInstance( "UsersService" ).clearRecentUsers() ) .everyDayAt( "09:00" ); application.scheduler.task( "Hearbeat" ) .call( () => runHeartBeat() ) .every( 5, "minutes" ) .onFailure( ( task, exception ) => { sendBadHeartbeat( exception ); } ); // Startup the scheduler application.scheduler.startup(); } function onApplicationEnd( appScope ){ // When the app is restart or dies make sure you cleanup appScope.scheduler.shutdown(); appScope.wirebox.shutdown(); } } ``` -------------------------------- ### ColdBox AI Setup & Management Commands Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/ai/agentic-coldbox.md Use these commands for initial installation, checking configuration, visualizing component hierarchy, and refreshing module installations. ```bash coldbox ai install # Interactive installation wizard ``` ```bash coldbox ai info # Show current configuration ``` ```bash coldbox ai tree # Visual hierarchy of components ``` ```bash coldbox ai tree --verbose # Include file paths ``` ```bash coldbox ai refresh # Sync with installed modules ``` -------------------------------- ### Create and Install ColdBox App Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/models/coding-solo-style/README.md Use CommandBox to create a new ColdBox application with the AdvancedScript skeleton, install ColdBox, and start the server with rewrites enabled. ```bash mkdir solo cd solo coldbox create app name=solo skeleton=AdvancedScript --installColdBox server start --rewritesEnable ``` -------------------------------- ### Install ColdBox AI Integration Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/ai/agentic-coldbox.md Use this command to install the ColdBox CLI and then initiate the AI integration setup wizard. The wizard guides you through agent selection and server configuration. ```bash # Install ColdBox CLI (if not already installed) box install coldbox-cli # Set up AI integration with an interactive wizard coldbox ai install ``` -------------------------------- ### Concrete Pre-Advice Example: Security and Logging Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/event-handlers/interception-methods/pre-advices.md Implement `preHandler()` to check user login status and override the event if unauthorized. Use `preList()` to log the start of the list action. ```javascript function preHandler( event, rc, prc, action, eventArguments ){ if( !security.isLoggedIn() ){ event.overrideEvent( 'security.login' ); log.info( "Unauthorized accessed detected!", getHTTPRequestData() ); } } function preList( event, rc, prc, eventArguments ){ log.info("Starting executing the list action"); } ``` -------------------------------- ### Start the ColdBox Development Server Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/for-newbies/getting-started-guide/60-minute-quick-start/my-first-coldbox-application.md Once your application is created, use the `server start` command to launch the development server and view your application in a browser. ```bash server start ``` -------------------------------- ### Example Wizard Session Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md This example demonstrates a typical interactive session with the ColdBox App Wizard, showing the prompts and user responses for configuring a new application. ```bash 🧙‍♂️ Welcome to the ColdBox App Wizard! 📁 Are you currently inside the "myapp" folder? [y/n]: n 🔥 Is this a BoxLang project? [y/n]: y 🎯 Are you creating an API? [y/n]: n 🎨 Would you like to configure Vite as your Front End UI pipeline? [y/n]: y 🐳 Would you like to setup a Docker environment? [y/n]: y 🗃️ Are you going to require Database Migrations? [y/n]: y ✨ Perfect! Creating your customized ColdBox application... ``` -------------------------------- ### Install Route Visualizer Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/routing/README.md Command to install the ColdBox Route Visualizer tool for debugging and visualizing routes. ```bash box install route-visualizer ``` -------------------------------- ### Install cborm Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/models/domain-modeling/README.md Install the ColdBox ORM Extensions module using CommandBox. ```bash install cborm ``` -------------------------------- ### Start Docker Development Environment Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Launch all services defined in your docker-compose.yml file to start your development environment. ```bash docker-compose up -d ``` -------------------------------- ### Setup New ColdBox Request for Each Test Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/testing-quick-start/integration-testing/test-setup.md Use the `setup()` function within `beforeEach()` to ensure each test runs with a fresh virtual request. This is crucial for test isolation. ```javascript function run() { describe( "Main Handler", function() { beforeEach( function( currentSpec ) { // Setup as a new ColdBox request, VERY IMPORTANT. ELSE EVERYTHING LOOKS LIKE THE SAME REQUEST. setup(); } ); it( "can render the homepage", function() { var event = this.get( "main.index" ); expect( event.getValue( name = "welcomemessage", private = true ) ).toBe( "Welcome to ColdBox!" ); } ); it( "can render some restful data", function() { var event = this.post( "main.data" ); debug( event.getHandlerResults() ); expect( event.getRenderedContent() ).toBeJSON(); } ); }); } ``` -------------------------------- ### Basic Model Test Setup Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/testing-quick-start/model-object-testing.md This is a standard setup for a ColdBox model test. It extends BaseModelTest, specifies the model to test, and initializes the model in the `beforeAll` method. ```javascript /** * The base model test case will use the 'model' annotation as the instantiation path * and then create it, prepare it for mocking and then place it in the variables scope as 'model'. It is your * responsibility to update the model annotation instantiation path and init your model. */ component extends="coldbox.system.testing.BaseModelTest" model="UserService"{ /*********************************** LIFE CYCLE Methods ***********************************/ function beforeAll(){ // setup the model super.setup(); // init the model object model.init(); } function afterAll(){ } /*********************************** BDD SUITES ***********************************/ function run(){ describe( "UserService Suite", function(){ it( "should save", function(){ }); it( "should search", function(){ }); it( "should list", function(){ }); }); } } ``` -------------------------------- ### Create Project Directory and Install ColdBox Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/for-newbies/getting-started-guide/60-minute-quick-start/installing-coldbox.md Creates a new directory for your project and installs the latest version of ColdBox into it using CommandBox. This action also generates a box.json file. ```bash mkdir 60-minute-quickstart --cd install coldbox ``` -------------------------------- ### Install cbsoap Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Install the cbsoap module to facilitate interaction with SOAP web services. ```bash install cbsoap ``` -------------------------------- ### Install cbstorages Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Install the cbstorages module to utilize its collection of model objects for managing native ColdFusion persistence structures. ```bash install cbstorages ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/layouts-and-views/coldbox-elixir.md Install all the Node dependencies listed in your package.json file. This includes ColdBox Elixir, Bootstrap, and jQuery. ```bash npm install ``` -------------------------------- ### List Installed Packages Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/for-newbies/getting-started-guide/README.md View all installed packages and their versions for your application. This helps in understanding project dependencies. ```bash list Dependency Hierarchy for myApp (0.0.0) +-- cbmessagebox (1.0.0) +-- coldbox (4.0.0) ``` -------------------------------- ### Install cbantisamy Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Use this command to install the cbantisamy module, which provides OWASP AntiSamy for XSS cleanup. ```bash install cbantisamy ``` -------------------------------- ### Install cbsecurity Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Use this command to install the cbsecurity module, which provides a security rule engine for your application. ```bash install cbsecurity ``` -------------------------------- ### AI Client Interaction Examples Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/ai/coldbox-mcp-server.md Examples of how AI clients can interact with the ColdBox MCP server to perform various tasks and retrieve application information using the 'tools/call' endpoint. ```text "What routes does my app have that match /api/users?" → tools/call list_routes "Which WireBox mappings are singletons?" → tools/call get_wirebox_mappings "Show me the hit rate of the `template` cache." → tools/call get_cache_stats { cacheName: "template" } "Are there any ERROR entries in my logs in the last hour?" → tools/call get_last_error "What scheduled tasks are registered, and when did they last run?" → tools/call get_schedulers "Run the nightly-cleanup task now." → tools/call run_task { schedulerName: "AppScheduler", taskName: "nightly-cleanup" } ``` -------------------------------- ### Basic Integration Test Examples Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/testing-quick-start/integration-testing/README.md These examples demonstrate basic integration tests for various ColdBox event handlers. They use the `execute()` method to trigger events and `expect()` for assertions on the returned request context. ```javascript it( "can do a relocation", function() { var event = execute( event = "main.doSomething" ); expect( event.getValue( "relocate_event", "" ) ).toBe( "main.index" ); } ); ``` ```javascript it( "can startup executable code", function() { var event = execute( "main.onAppInit" ); } ); ``` ```javascript it( "can handle exceptions", function() { // You need to create an exception bean first and place it on the request context FIRST as a setup. var exceptionBean = createMock( "coldbox.system.web.context.ExceptionBean" ).init( erroStruct = structNew(), extramessage = "My unit test exception", extraInfo = "Any extra info, simple or complex" ); prepareMock( getRequestContext() ).setValue( name = "exception", value = exceptionBean, private = true ) .$( "setHTTPHeader" ); // TEST EVENT EXECUTION var event = execute( "main.onException" ); } ); ``` ```javascript describe( "Request Events", function() { it( "fires on start", function() { var event = execute( "main.onRequestStart" ); } ); it( "fires on end", function() { var event = execute( "main.onRequestEnd" ); } ); } ); ``` ```javascript describe( "Session Events", function() { it( "fires on start", function() { var event = execute( "main.onSessionStart" ); } ); it( "fires on end", function() { // Place a fake session structure here, it mimics what the handler receives URL.sessionReference = structNew(); URL.applicationReference = structNew(); var event = execute( "main.onSessionEnd" ); } ); } ); ``` -------------------------------- ### Install and List AI Skills Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/ai/agentic-coldbox.md Use these commands to manage AI skills. Install new skills to extend agent capabilities or list existing ones to see what's available. ```bash coldbox ai skills install creating-handlers ``` ```bash coldbox ai skills list ``` ```bash coldbox ai skills list --verbose ``` -------------------------------- ### BoxLang Configuration Examples Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Configure your project to use BoxLang by setting the 'language' property to 'boxlang' in your 'box.json' or by setting 'testbox.runner' to 'boxlang'. These examples show the JSON structure for each method. ```json { "name": "My BoxLang App", "language": "boxlang", "testbox": { "runner": "/tests/runner.bxm" } } ``` ```json { "name": "My App", "testbox": { "runner": "boxlang" } } ``` -------------------------------- ### Install Project Dependencies (Windows) Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/layouts-and-views/coldbox-elixir.md When developing on Windows or running your VM on a Windows host, use the --no-bin-links switch during npm install to avoid potential issues. ```bash npm install --no-bin-links ``` -------------------------------- ### Install ColdBox Relax Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/recipes/building-rest-apis.md Install the ColdBox Relax module using CommandBox. Use --saveDev for development dependencies. ```bash install relax --saveDev ``` -------------------------------- ### Install TestBox with CommandBox Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/testing-quick-start/README.md Install TestBox, the BDD testing framework for CFML, using CommandBox. Use the --saveDev flag to indicate it's a development dependency. ```bash install testbox --saveDev ``` -------------------------------- ### Install cbcommons Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Install the cbcommons module to access a collection of common utility model objects like DateUtils, FileUtils, and more. ```bash install cbcommons ``` -------------------------------- ### startup() Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/scheduled-tasks.md Starts the scheduler. This method is automatically called by ColdBox and typically does not require manual invocation. ```APIDOC ## startup() ### Description Startup the scheduler. This is called by ColdBox for you. No need to call it. ### Method Not Applicable (Utility Method) ### Endpoint Not Applicable (Utility Method) ### Parameters None ### Response No specific response details provided, typically indicates success or failure. ``` -------------------------------- ### ColdBox AI Component Management: Guidelines Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/ai/agentic-coldbox.md Commands for listing, installing, and uninstalling AI guidelines. Use `--verbose` for more detailed output. ```bash coldbox ai guidelines list # List installed ``` ```bash coldbox ai guidelines list --verbose # With descriptions ``` ```bash coldbox ai guidelines install coldbox # Install specific ``` ```bash coldbox ai guidelines uninstall coldbox # Remove guideline ``` -------------------------------- ### Get Value with Default Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/request-context.md Retrieve a value from the context, providing a default if the value does not exist. This example also shows nested retrieval. ```javascript // get a value with a default value event.getValue('link','index.cfm?page=#event.getValue('page',1)#'); ``` -------------------------------- ### Schedule One-Off Tasks with Delay Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/promises-async-programming/scheduled-tasks.md Register tasks that execute only once, optionally with a delay. These are useful for initial setup or cache warming. Examples show delaying by minutes and seconds. ```javascript task( "build-up-cache" ) .call( () => wirebox.getInstance( "MyObject" ).buildCache() ) .delay( 1, "minutes" ); task( "notify-admin-server-is-up" ) .call( () => wirebox.getInstance( "MyObject" ).notifyAppIsUp( getUtil().getServerIp() ) ) .delay( 30, "seconds" ); task( "register-container" ) .call( () => ... ) .delay( 30, "seconds" ); ``` -------------------------------- ### Launch Interactive App Wizard Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Use the `coldbox create app-wizard` command or the `--wizard` flag with `create app` to interactively configure your new ColdBox application. This is ideal for beginners. ```bash coldbox create app-wizard ``` ```bash coldbox create app myApp --wizard ``` -------------------------------- ### Run ColdBox AI Diagnostics Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Use these commands to check the health and resource consumption of your ColdBox AI setup. They provide insights into installation completeness, configuration validity, and token usage for various AI models. ```bash coldbox ai doctor ``` ```bash coldbox ai stats ``` ```bash coldbox ai tree ``` -------------------------------- ### Define Routes Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/routing/routing-dsl/routing-groups.md This example shows a series of individual route definitions before grouping. ```javascript route( pattern="/news", target="public.news.index" ); route( pattern="/news/recent", target="public.news.recent" ); route( pattern="/news/removed", target="public.news.removed" ); route( pattern="/news/add/:title", target="public.news.add" ); route( pattern="/news/delete/:slug", target="public.news.remove" ); route( pattern="/news/v/:slug", target="public.news.view" ); ``` -------------------------------- ### BaseTestCase Setup Method Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/testing-quick-start/common-methods.md Prepares a ColdBox request context for testing. This method should be called before executing tests that involve request handling. ```javascript setup() ``` -------------------------------- ### Creating a Custom Request Context Decorator Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/request-context-decorator.md This example shows how to create a custom request context decorator by extending `coldbox.system.web.context.RequestContextDecorator`. It includes a `configure()` method for setup and overrides the `getValue()` method to auto-trim retrieved values. ```java component extends="coldbox.system.web.context.RequestContextDecorator"{ function configure(){ return this; } /** * @overriden * Get a value from the public or private request collection. and auto-trim it * @name The key name * @defaultValue default value * @private Private or public, defaults public. */ function getValue( required name, defaultValue, boolean private=false ){ var originalValue = ""; // Check if the value exists via original object, else return blank if( getRequestContext().valueExists( arguments.name ) ){ originalValue = getRequestContext().getValue( argumentCollection=arguments ); // check if simple if( isSimpleValue( originalValue ) ){ originalValue = trim( originalValue ); } } return originalValue; } } ``` -------------------------------- ### Custom API Security Interceptor Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/recipes/building-rest-apis.md Create a custom interceptor to secure API requests. This example uses `preProcess` and `eventPattern` to apply security logic only to events starting with 'api.'. It checks for a specific HTTP header ('APIUser') and overrides the event if authentication fails. ```cfscript /** * This interceptor secures all API requests */ component{ // This will only run when the event starts with "api." function preProcess( event, interceptData, buffer ) eventPattern = '^api\.' { var APIUser = event.getHTTPHeader( 'APIUser', 'default' ); // Only Honest Abe can access our API if( APIUser != 'Honest Abe' ) { // Every one else will get the error response from this event event.overrideEvent( 'api.general.authFailed' ); } } } ``` -------------------------------- ### Install bx-coldbox via BoxLang Module Installer Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/readme/release-history/whats-new-with-8.0.0.md Install the bx-coldbox module using the BoxLang module installer. This version is pre-compiled for BoxLang and offers performance optimizations. ```bash install-bx-module bx-coldbox ``` -------------------------------- ### Configure Basic Application Setup Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/configuration/coldbox.cfc/configuration-directives/coldbox.md Define core application settings such as the application name, the incoming event variable name, and the application mapping. ```javascript coldbox = { // The name of the application appName = "My App", // The name of the incoming URL/FORM/REMOTE variable that tells the framework what event to execute. Ex: index.cfm?event=users.list eventName = "event", // The URI of the ColdBox application on the webserver. Use when ColdBox app exists within subdirectory from project root, otherwise can be omitted appMapping = "" }; ``` -------------------------------- ### Install a ColdBox Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/for-newbies/getting-started-guide/README.md Install modules from ForgeBox to add functionality to your ColdBox application. This command installs the 'cbmessagebox' module. ```bash install cbmessagebox ``` -------------------------------- ### ColdBox get() Method for HTTP GET Requests Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/testing-quick-start/integration-testing/http-testing-methods.md Use the `get()` method to perform HTTP GET requests through the framework. It accepts route, parameters, headers, and rendering options. By default, it handles exceptions internally. ```javascript /** * Shortcut method to making a GET request through the framework. * * @route The route to execute. * @params Params to pass to the `rc` scope. * @headers Custom headers to pass as from the request * @renderResults If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_content * @withExceptionHandling If true, then ColdBox will process any errors through the exception handling framework instead of just throwing the error. Default: false. * @domain Override the domain of execution of the request. Default is to use the cgi.server_name variable. */ function get( string route = "", struct params = {}, struct headers = {}, boolean renderResults = true, boolean withExceptionHandling = false, domain = cgi.SERVER_NAME ) ``` -------------------------------- ### Preview Production Build Locally Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Serve a local preview of your production-ready build to test before deploying. ```bash npm run preview ``` -------------------------------- ### Install cbValidation Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/event-handlers/validation.md Use this command to install the official cbValidation module into your ColdBox application. Ensure you have Box installed and configured. ```bash box install cbvalidation ``` -------------------------------- ### Refresh AI Resources After Module Installation Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Automatically discover, install, and register AI guidelines and skills from newly installed or updated CommandBox modules. This ensures your AI context is always up-to-date. ```bash box install qb coldbox ai refresh ``` -------------------------------- ### Install bx-ai and cbMCP Modules Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/ai/README.md Install the necessary AI and MCP modules for your ColdBox application using the box CLI. The MCP endpoint will be live at http://localhost:/cbmcp after installation. ```bash box install bx-ai box install cbmcp ``` -------------------------------- ### Basic Relocation Examples Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/event-handlers/relocating.md Demonstrates various ways to use the relocate() method, including redirecting to a specific event, an external URL, or a relative URI. ```java relocate( "home" ); ``` ```java relocate( event="shop", ssl=true ); ``` ```java relocate( event="user.view", queryString="id=#rc.id#" ); ``` ```java relocate( url="http://www.google.com" ); ``` ```java relocate( uri="/docs/index.html" ) ``` -------------------------------- ### Example Usage (BoxLang) Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/delegates/coldbox-delegates.md Demonstrates how to use the Settings delegate methods within a BoxLang class. ```APIDOC ## Example Usage (BoxLang) ```java class delegates="Settings@cbDelegates" { function getApiBaseUrl() { return getSetting( "apiBaseUrl", "https://api.example.com" ) } function isFeatureEnabled( required string flag ) { var features = getSetting( "featureFlags", {} ) return features.keyExists( flag ) && features[ flag ] } function getMailConfig() { // Get the cbmailservices module settings return getModuleSettings( "cbmailservices" ) } function flagUser( required string userId ) { var flagged = getSetting( "flaggedUsers", [] ) flagged.append( userId ) setSetting( "flaggedUsers", flagged ) } } ``` ``` -------------------------------- ### Example Usage (CFML) Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/delegates/coldbox-delegates.md Demonstrates how to use the Settings delegate methods within a CFML component. ```APIDOC ## Example Usage (CFML) ```cfscript component delegates="Settings@cbDelegates" { function getApiBaseUrl() { return getSetting( "apiBaseUrl", "https://api.example.com" ) } function isFeatureEnabled( required string flag ) { var features = getSetting( "featureFlags", {} ) return features.keyExists( flag ) && features[ flag ] } function getMailConfig() { // Get the cbmailservices module settings return getModuleSettings( "cbmailservices" ) } function flagUser( required string userId ) { var flagged = getSetting( "flaggedUsers", [] ) flagged.append( userId ) setSetting( "flaggedUsers", flagged ) } } ``` ``` -------------------------------- ### Install cbi18n Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Use this command to install the cbi18n module for localization and internationalization capabilities. ```bash install cbi18n ``` -------------------------------- ### Install cbfeeds Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Use this command to install the cbfeeds module for RSS and ATOM feed support. ```bash install cbfeeds ``` -------------------------------- ### ColdBox View Rendering Examples Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/layouts-and-views/views/rendering-views.md Demonstrates various ways to render views using the #view()# function in ColdBox. This includes inline rendering, rendering from modules, rendering regions, and applying caching. ```javascript // render inline #view( 'tags/metadata' )# // render from a module #view( view="security/user", module="security" )# // render a region #view( name : "userLogins" )# // render and cache #view( view="tags/longRendering", cache=true, cacheTimeout=5, cacheProvider="couchbase" )# // render a view from the handler action function showData(event,rc,prc){ // data here return view( "general/showData" ); } // render an email body content in an email template layout body = layout( layout='email',view='templates/email_generic' ); ``` -------------------------------- ### Install cbdebugger Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Install the cbdebugger module to enhance your application with debugging capabilities and a debugging panel. ```bash install cbdebugger ``` -------------------------------- ### Create a New ColdBox Application Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/for-newbies/getting-started-guide/60-minute-quick-start/my-first-coldbox-application.md Use the `coldbox create app` command to scaffold a new application. Specify the desired template (e.g., 'default') and the application name. ```bash coldbox create app Quickstart ``` -------------------------------- ### Install Gulp Globally Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/layouts-and-views/coldbox-elixir.md Install Gulp as a global NPM package to make it available for all your ColdBox applications. ```bash npm install --g gulp ``` -------------------------------- ### Create Applications with Templates and Features Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Scaffold applications using specific templates like 'boxlang', 'modern', 'rest', 'flat', 'supersimple', or 'vite'. Enhance with features like migrations, Docker, Vite, REST API configuration, and AI integration. ```bash coldbox create app myApp skeleton=boxlang ``` ```bash coldbox create app myApp skeleton=modern ``` ```bash coldbox create app myApp skeleton=rest ``` ```bash coldbox create app myApp skeleton=flat ``` ```bash coldbox create app myApp skeleton=supersimple ``` ```bash coldbox create app myApp skeleton=vite ``` ```bash coldbox create app myApp --migrations ``` ```bash coldbox create app myApp --docker ``` ```bash coldbox create app myApp --vite ``` ```bash coldbox create app myApp --rest ``` ```bash coldbox create app myApp --ai ``` ```bash coldbox create app myFullStackApp --migrations --docker --vite --rest --ai ``` -------------------------------- ### Enable Server Rewrites with CommandBox Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/routing/requirements/README.md Use this command to start a server with URL rewrites enabled, powered by Tuckey. This is necessary for clean URLs like http://localhost/home/about. ```bash server start --rewritesEnable ``` -------------------------------- ### Manage AI Skills with ColdBox CLI Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Commands for managing AI skills, including listing, installing, removing, overriding, refreshing, and finding skills. Use '--list' for interactive installation and '--all' to install all available skills. ```bash coldbox ai skills list # List installed skills ``` ```bash coldbox ai skills list --verbose # With descriptions ``` ```bash coldbox ai skills install --list # Interactive install from registry ``` ```bash coldbox ai skills install --list coldbox/skills # Filtered by prefix ``` ```bash coldbox ai skills install --all # Install all available skills ``` ```bash coldbox ai skills remove creating-handlers # Remove a skill ``` ```bash coldbox ai skills override creating-handlers # Create a customizable override ``` ```bash coldbox ai skills refresh # Sync from installed modules ``` ```bash coldbox ai skills create # Scaffold a new custom skill ``` ```bash coldbox ai skills find "rest api" # Search skills by keyword ``` -------------------------------- ### Create ColdBox Applications Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Use the `coldbox create app` command to scaffold new applications. Specify `--boxlang` for BoxLang or `--cfml` for traditional CFML. ```bash coldbox create app myAwesomeApp ``` ```bash coldbox create app myAwesomeApp --boxlang ``` ```bash coldbox create app myCFMLApp --cfml ``` -------------------------------- ### Install cbjavaloader Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Use this command to install the cbjavaloader module for interfacing with Mark Mandel's JavaLoader. ```bash install cbjavaloader ``` -------------------------------- ### Scaffolding Resourceful Routes with CommandBox Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/routing/routing-dsl/resourceful-routes.md CommandBox provides a helpful command to assist in generating and registering resourceful routes. Run `coldbox create resource help` for detailed instructions. ```bash coldbox create resource help ``` -------------------------------- ### Create AI-Ready Module with ColdBox CLI Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Generates a module with an AI guideline and skill scaffold. This prepares the module for integration with AI assistants. ```bash coldbox create module BlogEngine --ai ``` -------------------------------- ### Install cbioc Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Use this command to install the cbioc module for integrating third-party dependency injection frameworks. ```bash install cbioc ``` -------------------------------- ### Install csrf Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Install the csrf module to protect your ColdBox application against Cross-Site Request Forgery attacks. ```bash install csrf ``` -------------------------------- ### Create Resource with Tests and Migrations Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Generates a resource along with automated tests and database migration files. This ensures production-readiness from the start. ```bash coldbox create resource Users --tests --migration ``` -------------------------------- ### Starting Async Computations with Futures Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/promises-async-programming/async-pipelines-and-futures.md Demonstrates two primary ways to initiate asynchronous computations using ColdBox Futures: directly via the `newFuture()` constructor with a closure, or using the `run()` method which accepts either a closure or a CFC instance and method. ```javascript // Constructor newFuture( () => newUser() ) // Run Operations newFuture().run( () => newUser() ) newFuture().run( supplier : userService, method : "newUser" ) ``` -------------------------------- ### Check Installed Modules Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/ai/coldbox-mcp-server.md Verify that the 'cbmcp' module and its 'bx-ai' dependency are installed using the 'box list' command. ```bash box list ``` ```bash box list | grep bx-ai ``` -------------------------------- ### Incoming JSON Payload Example Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/recipes/building-rest-apis.md An example of an incoming JSON payload that ColdBox can automatically deserialize into the request collection. ```json { "name" : "Jon Clausen", "type" : "awesomeness", "data" : [ 1,2,3 ] } ``` -------------------------------- ### Install bx-coldbox via CommandBox Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/readme/release-history/whats-new-with-8.0.0.md Install the bx-coldbox module using the CommandBox package manager. This module is optimized for BoxLang. ```bash box install bx-coldbox ``` -------------------------------- ### Create ColdBox Service Model Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/for-newbies/getting-started-guide/60-minute-quick-start/adding-a-model.md Use this CommandBox command to generate a new service model with a specified method and an accompanying unit test. The --open flag automatically opens the generated files. ```bash coldbox create service name="ContactService" methods="getAll" --open ``` -------------------------------- ### Register and Activate Module with Instantiation Path Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/module-service/loading-a-la-carte-modules.md Use this method to load any module by providing its name and its instantiation path. The instantiation path should point to the parent directory of the module folder. ```javascript controller.getModuleService().registerAndActivateModule('Calendar','shared.modules') ``` -------------------------------- ### Install ColdBox Debugger Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/event-handlers/event-caching.md Install the ColdBox Debugger module to access the CacheBox monitor for managing cache elements. ```bash box install cbdebugger ``` -------------------------------- ### get() Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/testing-quick-start/integration-testing/http-testing-methods.md Shortcut method to making a GET request through the framework. It allows specifying the route, parameters, headers, and rendering behavior. ```APIDOC ## get() ### Description Shortcut method to making a GET request through the framework. Allows specifying route, parameters, headers, and rendering behavior. ### Parameters #### Path Parameters None explicitly defined. #### Query Parameters None explicitly defined. #### Request Body None explicitly defined. ### Method GET ### Endpoint Not explicitly defined, but implies a route execution. ### Parameters - **route** (string) - Required - The route to execute. - **params** (struct) - Optional - Params to pass to the `rc` scope. - **headers** (struct) - Optional - Custom headers to pass as from the request. - **renderResults** (boolean) - Optional - If true, then it will try to do the normal rendering procedures and store the rendered content in the RC as cbox_rendered_content. Default: true. - **withExceptionHandling** (boolean) - Optional - If true, then ColdBox will process any errors through the exception handling framework instead of just throwing the error. Default: false. - **domain** (string) - Optional - Override the domain of execution of the request. Default is to use the cgi.server_name variable. ### Request Example ```javascript // Example usage (assuming framework context) let response = get('/users', { id: 1 }, { 'X-API-Key': 'your-key' }); ``` ### Response #### Success Response (200) Depends on the route executed. The rendered content might be stored in `cbox_rendered_content` if `renderResults` is true. #### Response Example ```json { "data": "..." } ``` ``` -------------------------------- ### Start Vite Development Server Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Launch the Vite development server for your ColdBox application, enabling hot module replacement and fast updates. ```bash npm run dev ``` -------------------------------- ### Install cbswagger Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/the-basics/modules/core-modules.md Install the cbswagger module to automatically generate OpenAPI (Swagger) documentation for your ColdBox application's routes. ```bash install cbswagger ``` -------------------------------- ### Get ColdBox CLI Help Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Access the help documentation for the ColdBox CLI to understand its available commands and options. This is useful for exploring the CLI's capabilities. ```bash coldbox --help ``` -------------------------------- ### Manage AI Guidelines with ColdBox CLI Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Commands to list, add, remove, override, and refresh AI guidelines. Use 'list --verbose' for descriptions and 'create' to scaffold a new guideline. ```bash coldbox ai guidelines list # List all guidelines ``` ```bash coldbox ai guidelines list --verbose # With descriptions ``` ```bash coldbox ai guidelines add qb cbsecurity # Add specific guidelines ``` ```bash coldbox ai guidelines remove qb # Remove a guideline ``` ```bash coldbox ai guidelines override coldbox # Create a customizable local override ``` ```bash coldbox ai guidelines refresh # Sync from installed modules ``` ```bash coldbox ai guidelines create # Scaffold a new custom guideline ``` -------------------------------- ### Create ColdBox Views Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/getting-started/coldbox-cli.md Use the 'create view' command to generate view templates. You can specify a path, include helper functions, or provide initial content. ```bash coldbox create view users/index ``` ```bash coldbox create view users/profile --helper ``` ```bash coldbox create view welcome content="

Welcome to Our App!

" ``` -------------------------------- ### Install bx-ai Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/ai/README.md Install the bx-ai module using CommandBox or an OS package manager. Most AI features require this module and BoxLang. ```bash # Using CommandBox box install bx-ai # Using OS package manager install-bx-module bx-ai ``` -------------------------------- ### Install CbDebugger Module Source: https://github.com/ortus-docs/coldbox-docs/blob/v8.x/digging-deeper/recipes/debugging-coldbox-apps.md Install the CbDebugger module as a development dependency using CommandBox. This module provides debugging capabilities for ColdBox applications. ```bash install cbdebugger --saveDev ```