javascript - optional parameter in flatiron/director -



javascript - optional parameter in flatiron/director -

is possibile create route optional parameter in flatiron/director?

var router = router({ 'order' : function(){ // create order }, 'order/:orderid' : function(orderid){ // load order id } }).init();

can utilize 1 single route manage edit/load order?

from director docs:

var router = router({ // // given route '/hello/world/johny/appleseed'. // '/hello': { '/world/?([^\/]*)\/([^\/]*)/?': function (a, b) { console.log(a, b); } } });

basically utilize regex instead of simple :tokens

johny , appleseed become optional parameters.

javascript routing flatiron.js

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -