http://coldfusion.com logo
#box-products
Title
# box-products
d

David Rogers

06/10/2022, 2:59 PM
with the coldbox router is there a conditional handler target, something like
Copy code
route("/foo")
.withCondition(() => {...})
.truecase(() => { return { withAction: "", toHandler: "", ...})
.falsecase(() => { return { withAction: "maintenanceFallback", toHandler: "" } })
with the intent like "usually this invokes the
a:b.c
handler but on Sunday between 12am-1am this route needs to invoke
foo:bar.baz
"
looks like
Copy code
.route( SAME_REST_PATH )
    .withCondition( function() { ... } )
    .withAction( A )
    .toHandler( ... )
.route( SAME_REST_PATH )
    .withCondition( function() { ... } )
    .withAction( B )
    .toHandler( ... )
does the trick, wondering if how this seems to register and retain both
route
calls to the same path is intentional / guaranteed behavior? I was worried the latter would stomp the former but they seem to coexist
3 Views