Created
January 11, 2012 18:47
-
-
Save apeace/1596139 to your computer and use it in GitHub Desktop.
URL params breaking director?
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
// visiting localhost:8080/blah?blah=blah outputs this: | |
// { status: 404, | |
// headers: {}, | |
// body: { error: 'Could not find path: /blah?blah=blah' } } | |
var http = require('http'); | |
var director = require('director'); | |
var router = new director.http.Router(); | |
var server = http.createServer(function (req, res) { | |
router.dispatch(req, res, function (err) { | |
if (err) { | |
console.log(err); | |
res.writeHead(404); | |
res.end(); | |
} | |
}); | |
}); | |
router.get(/.*/, function () { | |
console.log('good'); | |
this.res.writeHead(200); | |
this.res.end(); | |
}); | |
server.listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment