PHP Classes

File: test/js/test3.js

Recommend this page to a friend!
  Classes of Nikos M.   Dromeo PHP Router Library   test/js/test3.js   Download  
File: test/js/test3.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Dromeo PHP Router Library
Route HTTP requests to functions with URL patterns
Author: By
Last change: v.1.1.2 contd, JS: fix original match index computation issue
Date: 1 year ago
Size: 931 bytes
 

Contents

Class file image Download
"use strict"; var path = require('path'), Dromeo = require(path.join(__dirname, '../../src/js/Dromeo.js')), echo = console.log, stringify = JSON.stringify ; function defaultHandler(route) { echo('Default Handler'); echo(route); } var router1 = new Dromeo(), router2 = new Dromeo(); router1.on([ { route:'/foo/{:user}/{:id}', name: 'route1', handler: defaultHandler } ]); router2.on([ { route:'/foo{/%ALPHA%-%ALPHA%:user(2)}', name: 'route2', handler: defaultHandler } ]); echo('Dromeo.VERSION = ' + Dromeo.VERSION); echo(); router1.route('/FOO/USER/ID'.toLowerCase(), '*', true, '/FOO/USER/ID', 'ORIG'); router1.route('/FOO/Foo/ID'.toLowerCase(), '*', true, '/FOO/Foo/ID', 'ORIG'); router2.route('/FOO/USER-User'.toLowerCase(), '*', true, '/FOO/USER-User', 'ORIG'); router2.route('/FOO/Foo-fOO'.toLowerCase(), '*', true, '/FOO/Foo-fOO', 'ORIG');