const fs = require('fs'); app.get('/files', (req, res) => { fs.readdir('./uploads', (err, files) => { if (err) { return res.status(500).send('Unable to fetch files.'); } res.send(files); }); });