Is it possibile create a route with optional parameter in flatiron/director?
var router = Router({
'order' : function(){
// create a order
},
'order/:orderId' : function(orderId){
// load order by id
}
}).init();
Can I use one single route to manage the edit/load order?
From director docs:
var router = Router({
//
// given the route '/hello/world/johny/appleseed'.
//
'/hello': {
'/world/?([^\/]*)\/([^\/]*)/?': function (a, b) {
console.log(a, b);
}
}
});
Basically use regex instead of simple :tokens
johny
and appleseed
become optional parameters.