const express = require('express') const fs = require('fs') const app = express() const port = 3000 app.set('view engine', 'pug') app.set('views', './views') app.get('/:repository', (req, res) => { var dirList = fs.readdirSync('./user-content-access/' + req.params.repository, (err, files) => { if (err) console.log(err) else return files }) dirList.forEach (file => console.log(file) ) res.render('index', { dirList: dirList }) }) app.listen(port, () => { console.log(`Example app listening on port ${port}`) })