New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Versioned Routes example code does not work. #1641
Comments
Fix: #1642 |
Released as: |
Please check out the updated example code. |
@hekike Please, update the document for other people. :) |
Thanks, website updated! |
Same error in Restify V: 7.6.0 |
#Source Code
http://restify.com/docs/home/
var restify = require('restify');
var server = restify.createServer();
function sendV1(req, res, next) {
res.send('hello: ' + req.params.name);
return next();
}
function sendV2(req, res, next) {
res.send({hello: req.params.name});
return next();
}
var PATH = '/hello/:name';
server.get({path: PATH, version: '1.1.3'}, sendV1);
server.get({path: PATH, version: '2.0.0'}, sendV2);
server.listen(8080);
Bug Report
assert.js:42
throw new errors.AssertionError({
^
AssertionError [ERR_ASSERTION]: Method 'GET' already declared for route '/hello/:'
at Router._insert (/usr/local/globalcdn/zonemaker/node_modules/find-my-way/index.js:208:7)
at Router._on (/usr/local/globalcdn/zonemaker/node_modules/find-my-way/index.js:120:21)
at Router.on (/usr/local/globalcdn/zonemaker/node_modules/find-my-way/index.js:47:8)
at RouterRegistryRadix.add (/usr/local/globalcdn/zonemaker/node_modules/restify/lib/routerRegistryRadix.js:42:21)
at Router.mount (/usr/local/globalcdn/zonemaker/node_modules/restify/lib/router.js:167:20)
at Server.serverMethod [as get] (/usr/local/globalcdn/zonemaker/node_modules/restify/lib/server.js:1476:33)
at Object. (/usr/local/globalcdn/zonemaker/app.js:17:8)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
Restify Version
v7.1.0
Node.js Version
v8.8.1
The text was updated successfully, but these errors were encountered: