I'm using the following get
:
app.get("/:project/*", auth, function (req, res) {
Then parsing against a config file to load a directory dynamically:
var path = req.params[0] ? req.params[0] : "index.html";
res.sendfile( path, { root: "./builds/" + config[req.params.project].dir + "/dist/" } );
Which works great, only problem is that it requires my urls to end with a "/" if I'm going to the default (index.html
). For example, I have to use http://server.com/some_project/
and if the trailing slash isn't there it throws a Cannot GET /some_project
error. Curious if there's a way around this?