How can I escape routes in Express and Node.js when using the /: notation? Here's what I'm doing:
app.get('/:route1/:route2', function(req, res){
var route1 = req.params.route1;
var route2 = req.params.route2;
MongoClient.connect(MongoUrl, function(err, db) {
if(err) throw err;
db.collection(route1)
.findOne({'_id' : new ObjectID(route2)},
function(err, doc){
res.send(doc);
});
});;
But by doing that, it won't load the js or css. I've tried if statements to no avail:
if(req.params.route1 !== 'javascripts'){//then do something}