Skip to content

Instantly share code, notes, and snippets.

@ahamid
Created October 24, 2014 03:18
Show Gist options
  • Save ahamid/4064dc457a80ced1ab29 to your computer and use it in GitHub Desktop.
Save ahamid/4064dc457a80ced1ab29 to your computer and use it in GitHub Desktop.
Express recursive route matching can overflow stack
var express = require("express");
var app = express();
var TOO_MANY = 8000;
function handler(req, res) {
res.send("handler");
}
// test higher routes, eventually you will get
// RangeError: Maximum call stack size exceeded
for (var i = 0; i < TOO_MANY; i++) {
app.get('/' + i, handler);
}
app.listen(8181);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment