The Ortus BlogBox

"Ortus: A rise, beginning, coming into being, born, the origin!"

 

 

Category Filtering: 'coldbox-connection'

 

REST2016 - Route Conditions

Luis Majano
Mar 23, 2016

 

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 closure/UDF is called to verify the route with your own custom conditions. This is a great way to create some routes that must match certain environment criterias before they fire. Let's say you only want to fire some routes if they are using FireFox, or a user is logged in, or whatever.

// condition closure
function(requestString){}

// Routing with condition
addRoute(
    pattern="/go/ff", 
    response="

Hello FireFox!

", condition=function(requestString){ return ( findnocase( "Firefox", cgi.HTTP_USER_AGENT ) ? true : false ); } );
Happy Resting!!
ColdBox Connection, ColdBox MVC, REST, RoadShow 0

REST2016 - Route Responses

Luis Majano
Mar 14, 2016

 

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.

The response argument can be a string or a closure or UDF pointer. The closure and UDF will receive a rc argument which represents the request collection parsed already for you. The simple string can also contain replacement strings that are binded to the parsed parameters from the pattern by using {key} replacements. You can even execute runEvent() within your closure and delegate to whatever event you want instead of auto-routing as well.

// Simple response routing
addRoute( 
    pattern="/users/hello", 
    response="

Hello From RESTLand

", statusCode=200 ); // Simple response routing with placeholders addRoute( pattern="/users/:username", response="

Hello {username} From RESTLand

", statusCode=200 ); // Closure/UDF response routing addRoute( pattern="/users/:username", response=function(rc){ // Do some code here // more code return "

Hello #arguments.rc.username# from RESTLand

"; } ); // Closure/UDF response routing with event support addRoute(pattern="/users/:username", response=function(rc){ // Do some code here // more code return runEvent(event='api:users.data', eventArguments={quickData=true}); });
Happy Resting!!
ColdBox Connection, ColdBox MVC, REST, RoadShow 0

REST2016 - Creating Sub-module URL entry points

Luis Majano
Mar 11, 2016

 

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 configure() method.

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 Connection, ColdBox MVC, REST, RoadShow 0

REST2016 - Introduction to RESTful Tools - Coldbox Relax

Gavin Pickin
Mar 11, 2016

 

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.

ColdBox Connection, ColdBox MVC, Relax, REST, RoadShow 0

REST2016 - Versioning Your ColdBox REST API with Modules (Runnable Example)

Brad Wood
Mar 09, 2016

 

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.

ColdBox Connection, ColdBox MVC, REST, RoadShow, Sample Apps, Tutorials 0

ColdBox Connection 4/23 Noon Central on JS and CSS Workflows

Brad Wood
Apr 22, 2015

 

We're having another ColdBox Connection Thursday the 23rd at noon central time where special guest Jon Clausen will share how to work with static assets like CSS and JavaScript.  Things he'll cover:

  • Workflows and Dependency Management for CSS and Javascript with Bower
  • Optimizing production CSS and Javascript using NPM and Grunt
  • Be the boss of your CSS with SASS  (Depending on the level of experience with this on the call, I can be brief or go a little further in depth)

And if we have enough time, we'll try to touch on these topics as well.

  • Migrating from Apache: Running blazing fast Coldbox Apps with NGINX/Lucee
  • Automating Coldbox and CFML deployment (and rollback) on ACF and Railo with Capistrano

The show will be in our regular Adobe Connect room.  See you then!

http://experts.adobeconnect.com/coldbox-connection/

The recording will also be posted here:

http://www.coldbox.org/media/connection

ColdBox Connection, ColdBox MVC 0

ColdBox Connection Video: Intro To TestBox

Luis Majano
Jan 29, 2014

 

Here is our recording of our January ColdBox Connection about TestBox, the xUnit and BDD framework for ColdFusion (CFML).

 

ColdBox Connection, ColdBox MVC, TestBox 0

ColdBox Connection: Intro To TestBox and BDD

Brad Wood
Jan 26, 2014

 

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.  TestBox is also more flexible and supports the Behavior Driven Development (BDD) style of testing.  Come join us, and if you can't make it we will be recording the show.

Tuesday January 28th Noon Central Standard Time

http://experts.adobeconnect.com/coldbox-connection

Recording:

ColdBox Connection, ColdBox MVC, TestBox 6

ColdBox Connection On ColdBox ORM And ContentBox Contest Winners Announced

Brad Wood
Dec 17, 2012

 

Everyone, we have an exciting ColdBox Connection scheduled for tomorrow, the 18th.  First, we'll be announcing the winners of our ContentBox Christmas Contest.  We're super excited about the submissions we received.  They're all out on ForgeBox already waiting to be installed and played with. 

After that, we'll get on with the Coldbox Connection show which will be presented by Jeremey DeYoung and will talk about how ColdBox ORM has made his life easier.  This was a topic requested by the community and we're delivering.  Please show up and hang out.  The show will start at Noon CST and here is the URL:

http://experts.adobeconnect.com/coldbox-connection

ColdBox Connection, ColdBox MVC, Community, ContentBox CMS, ORM 0

ColdBox Connection Today at Noon CST

Brad Wood
Nov 20, 2012

 

Today, we will be having another of our regularly scheduled ColdBox Connection Meetings at Noon Central time.  Kalen will be leading a short discussion on integration testing.  Please stop by and ask some questions.

http://experts.adobeconnect.com/coldbox-connection

ColdBox Connection, ColdBox MVC 0
1 2 3 >>