Permalink
Browse files

Allow plain text matchers when you don't want regular expressions.

  • Loading branch information...
1 parent 03ae3bd commit b95c617b6a96cbbf7d4b389c626dbc226ff1030a @creationix committed Mar 22, 2010
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/node-router.js
View
@@ -42,6 +42,9 @@ exports.getServer = function getServer(logger) {
// Adds a route the the current server
function addRoute(method, pattern, handler, format) {
+ if (typeof pattern === 'string') {
+ pattern = new RegExp("^" + pattern + "$");
+ }
var route = {
method: method,
pattern: pattern,

0 comments on commit b95c617

Please sign in to comment.