Skip to content

Commit

Permalink
use prefix as base for '/' routes like explorer or non-strict hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
svanderbleek committed Sep 24, 2012
1 parent 5a7db39 commit d4a6fb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/restful.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ exports.extendRouter = function (router, resources, options, respond) {
//
// Bind GET / to a generic explorer view of routing map ( using `director-explorer` )
//
router.get('/', function () {
router.get(options.prefix + '/', function () {
var rsp = '';
//
// Remark: Output the basic routing map for every resource using https://github.com/flatiron/director-reflector
Expand All @@ -178,7 +178,7 @@ exports.extendRouter = function (router, resources, options, respond) {
this.res.end(rsp);
});
} else {
router.get('/', function (_id) {
router.get(options.prefix + '/', function (_id) {
var res = this.res,
req = this.req;
if (!options.strict) {
Expand Down
6 changes: 5 additions & 1 deletion test/macros/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ macros.resourceTest = function (name, options, context) {
}

return context
.get(prefix)
.expect(200)
.get(prefix + '/creature')
.expect(200)
.next()
Expand Down Expand Up @@ -180,6 +182,8 @@ macros.nonStrictResourceTest = function (options, context) {
var prefix = options.prefix || '';

return context
.get(prefix)
.expect(200)
.get(prefix + '/creature')
.expect(200)
.next()
Expand Down Expand Up @@ -532,4 +536,4 @@ macros.nonStrictTypeValidationTest = function (options, context) {
.next()
.post('/user', { email: "marak.squires@gmail.com", age: 50 })
.expect(201)
};
};

0 comments on commit d4a6fb1

Please sign in to comment.