Browse files

Extend readme. Add pathes with "?" to test

  • Loading branch information...
1 parent e793e94 commit 02eaf026d683097189628c43a2b0c43a4946dc38 @akaspin committed May 20, 2010
Showing with 14 additions and 0 deletions.
  1. +12 −0
  2. +2 −0 test/test-basic.js
@@ -29,6 +29,18 @@ Usage of *daleth* is very simple:
handler(request, response, args);
+*daleth* takes set of two-element arrays that contains `regex` and `handler`
+as arguments and returns "route" function. `Regex` is full JavaScript RegExp
+object that can include "search groups". `Handler` can be any object, not just
+a function.
+"Route" function takes two arguments: `path` and `callback`. Callback also
+takes two arguments: routed handler and array of extracted matching search
+groups. If `path` includes "?" symbol, *daleth* trashes it and all trailing
@@ -31,6 +31,8 @@ var route = require("../")(
{path: "/User", expect: {name:"Fallback", args:[]}},
{path: "/User/", expect: {name:"Fallback", args:[]}},
{path: "/user/name", expect: {name:"#2", args:["name"]}},
+ {path: "/user/name?slug=test", expect: {name:"#2", args:["name"]}},
+ {path: "/user/name/?slug=test", expect: {name:"#2", args:["name"]}},
{path: "/user/smith", expect: {name:"#2", args:["smith"]}},
{path: "/user/name/any", expect: {name:"Fallback", args:[]}},
{path: "/user/nam1", expect: {name:"Fallback", args:[]}},

0 comments on commit 02eaf02

Please sign in to comment.