Created test case

master
Sven Slootweg 9 years ago
parent 3481e8abbd
commit bc71b5e0a6

@ -0,0 +1,33 @@
var app = require("express")();
var router = require("express-promise-router")();
var Promise = require("bluebird");
app.use(function(req, res, next) {
console.log("Incoming request: " + req.method.toUpperCase() + " " + req.url);
next();
})
router.param("item", function(req, res, next, itemId) {
console.log("Got itemId");
req.itemId = itemId;
return Promise.reject(new Error("Sample error"));
});
router.get("/item/:item", function(req, res) {
console.log("route /item/:item");
res.send(req.itemId);
});
router.get("/", function(req, res) {
console.log("route /");
res.redirect("/item/42");
});
app.use(router);
app.use(function(req, res, next, err) {
console.log("Error handling route reached");
res.status(500).send("Oh noes!");
})
app.listen(3456);

@ -0,0 +1,20 @@
{
"name": "express-promise-router-bugcase",
"version": "1.0.0",
"description": "Testcase for demonstrating a bug in express-promise-router",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@git.cryto.net:projects/joepie91/express-promise-router-bugcase"
},
"author": "Sven Slootweg",
"license": "WTFPL",
"dependencies": {
"bluebird": "^3.3.3",
"express": "^4.13.4",
"express-promise-router": "^1.0.0"
}
}
Loading…
Cancel
Save