var express = require('express'); const fs = require('fs'); var router = express.Router(); /* GET home page. */ router.get('/', function (req, res, next) { data = { title: 'Movies', scripts: [] }; const f = fs.readdirSync('./public/assets/list/'); f.forEach(file => { data.scripts.push("/assets/list/" + file); }); res.render('list', data); }); module.exports = router;