Skip to content

Instantly share code, notes, and snippets.

@planeguy
Created August 3, 2014 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save planeguy/fb8f5da7502d1d7e06d2 to your computer and use it in GitHub Desktop.
Save planeguy/fb8f5da7502d1d7e06d2 to your computer and use it in GitHub Desktop.
Restify paths to different methods are going to same method
var restify = require("restify");
var server = restify.createServer();
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser({ mapParams: false }));
var paths = {
"thing-draft": {
name: "thing-draft",
path: "/:archive/archive/:ref/draft",
version: "1.0"
}
}
server.get(paths["thing-draft"], function (req, res, next) {
console.log("GO HERE");
next();
});
server.put(paths["thing-draft"], function (req, res, next) {
console.log("DON'T GO HERE");
next();
});
var port = 3000;
server.listen(port, function () {
console.log('Server running at http://127.0.0.1:'+port+'/ Ctrl-C to end');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment