controller
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -57,3 +57,3 @@ var isRegExp = require('util').isRegExp; | ||
if (!isRegExp(path) && self.options.prefix) { | ||
path = join(options.prefix, path); | ||
path = join(self.options.prefix, path); | ||
} | ||
@@ -60,0 +60,0 @@ app[route.method](path, middleware, action.handler); |
{ | ||
"name": "controller", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "an action controller for express", | ||
@@ -5,0 +5,0 @@ "main": "lib/controller.js", |
@@ -38,2 +38,19 @@ var assert = require('assert'); | ||
}); | ||
it('should route with a prefix', function() { | ||
var c = ctrl({prefix: '/prefix/'}); | ||
var action = function someAction(){}; | ||
var doThing = function thing(){}; | ||
c.define('action', ['thing'], action); | ||
c.route('GET', '/action', 'action'); | ||
var anapp = app(); | ||
var didCall = false; | ||
anapp.on('get', function(route, mw, theAction) { | ||
assert(route === '/prefix/action'); | ||
didCall = true; | ||
}); | ||
c.attach(anapp); | ||
assert(didCall === true); | ||
}); | ||
describe('direct()', function() { | ||
@@ -40,0 +57,0 @@ it('should allow direct attachment', function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15500
267