README
reserved-filenames
All filenames reserved by browsers, bots, etc.
Useful to prevent weird 404 errors.
Install
npm install @chatoo2412/reserved-filenames
How to Use
// server.js
import Koa from 'koa';
import serve from 'koa-static';
import reservedFilenames from '@chatoo2412/reserved-filenames';
const server = new Koa();
server.use(serve('path/to/static'));
server.use((ctx, next) => {
if (reservedFilenames.includes(ctx.path.substring(1))) {
ctx.throw(404);
return;
}
next();
});
server.use(/* ... */);
server.listen(/* ... */);
Contributing
Welcome!