ColdBox is an excellent MVC framework that can be used to solve many problems, from creating simple websites to enterprise-level applications. With built-in support for logging, caching, routing, dependency injection, testing, documentation, and more, it covers most of your needs as a developer. It also supports a modular architecture that allows you to grow your application as needed.
Sometimes when you define an incoming API route, you want it to match certain environment or aspect conditions. The
addRoute() has an argument called
condition, which can be a closure or UDF pointer that must return a
boolean and receives the incoming
requestString. You can then decide if the route should execute or just be ignored.
So if a route matches via the
pattern, then this closu...
You can route responses inline with ColdBox via the
addRoute() function globally in your main
routes.cfm template or within any Module as well. This will allow you to build simple response functions or even mock out or stub a RESTFul service very easily. The paremeters you will use for response routing will be:
response, statusCode and statusText.
response argument can be a string or a closure or UDF pointer. T...
In this entry I will go over how to leverage ColdBox's Modular architecture to RESTFul routing.
In ColdBox, every module's
ModuleConfig.cfc you create has two important facets for building RESTFul services: 1) The
this.entryPoint and the 2)
routes structure in the
If you are creating ColdBox applications using modules, then you will benefit with the capability to nest entry points so they can match to nested sub-modules. Let's say you have the following module structure:
+modules + api + security + data
ColdBox Relax is a set of restful tools, for lazy experts, that provides an easy way to describe RESTful web services, test RESTful Web Services, monitor RESTful web services, and document your RESTful API.
In our ColdBox RESTFul RoadShow this month, we've been talking about why ColdBox is the fastest and easiest ways to build a robust REST API in CFML. One of the very powerful features of the ColdBox MVC Platform is that you can use modules to break your apps and APIs up into management chunks instead of building a monolith. Modules also let you decouple pieces of your application so multiple teams can work on different parts. And with the power of CommandBox's CLI and package manager to assemble your app's dependencies, you can even store modules in a completely separate code repository! This is exactly what we're going to demo today.
This Tuesday the 28th we'll be bringing back the ColdBox Connection to introduce TestBox, CFML's new unit testing platform. The show will be at Noon Central time. TestBox is MXUnit-compatible so it's easy to get your current testing suite set up. T...