Created
August 3, 2014 06:26
-
-
Save planeguy/fb8f5da7502d1d7e06d2 to your computer and use it in GitHub Desktop.
Restify paths to different methods are going to same method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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