Skip to content

Instantly share code, notes, and snippets.

@apeace
Created January 11, 2012 18:47
Show Gist options
  • Save apeace/1596139 to your computer and use it in GitHub Desktop.
Save apeace/1596139 to your computer and use it in GitHub Desktop.
URL params breaking director?
// 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