Natively in Node you can't, but you may use a 3rd party module for this purpose.
For example, using the glob module:
var glob = require('glob');
app.get('/coverage', function(req, res) {
glob(path.join(__dirname, '/coverage', 'PhantomJS *', 'lcov-report', 'index.html'), function(err, matches) {
if (err) {
// handle error
}
fs.readFile(matches[0], 'utf8', function(err, content) {
if(!err) {
res.send(content);
} else {
res.statusCode(404);
res.send('');
}
});
});
});
I haven't tested it, but I suppose it's gonna work!
and don't forget to handle errors, kids!