30 lines woo

This commit is contained in:
Erin 2023-07-01 17:02:16 -04:00
parent 21f7705970
commit 5a5dbce8ed

View file

@ -9,8 +9,6 @@ const sites = fs.readFileSync('./webring.txt', 'utf-8')
// exclude empty lines and lines that start with # because why not // exclude empty lines and lines that start with # because why not
.filter(site => site && !site.startsWith('#')); .filter(site => site && !site.startsWith('#'));
console.log(sites);
// modulo that does the right thing with negatives // modulo that does the right thing with negatives
// https://stackoverflow.com/a/4467559 // https://stackoverflow.com/a/4467559
const mod = (n, m) => ((n % m) + m) % m; const mod = (n, m) => ((n % m) + m) % m;
@ -29,6 +27,4 @@ express()
.get('/prev', (request, response) => handle(-1, request, response)) .get('/prev', (request, response) => handle(-1, request, response))
.get('/next', (request, response) => handle(+1, request, response)) .get('/next', (request, response) => handle(+1, request, response))
.get('/list', (_, response) => response.type('txt').send(sites.join('\n'))) .get('/list', (_, response) => response.type('txt').send(sites.join('\n')))
.listen(process.env.PORT || 8080, () => { .listen(process.env.PORT || 8080);
console.log('doing the thing');
})