Skip to content

Instantly share code, notes, and snippets.

@brigand
Created Jun 13, 2021
Embed
What would you like to do?
let estate;
let signed;
let watches;
function getImagesAndServePages() {
estate = require('fs').readdirSync('./public/imgs/estate');
signed = require('fs').readdirSync('./public/imgs/signed');
watches = require('fs').readdirSync('./public/imgs/watches');
}
getImagesAndServePages();
setInterval(() => {
getImagesAndServePages();
}, 1000 * 60);
app.get('/', (req, res) => {
res.render('pages/index');
});
app.get('/estate', (req, res) => {
res.render('pages/estate', {imgs: estate});
});
app.get('/signed', (req, res) => {
res.render('pages/signed', {imgs: signed});
});
app.get('/watches', (req, res) => {
res.render('pages/watches', {imgs: watches});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment