Initial commit

This commit is contained in:
abrendan
2023-11-30 14:15:19 +00:00
commit e4599df811
5457 changed files with 500139 additions and 0 deletions

21
node_modules/server/plugins/favicon/index.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
const modern = require('../../src/modern');
const favicon = require('serve-favicon');
module.exports = {
name: 'favicon',
options: {
__root: 'location',
location: {
type: String,
file: true,
env: 'FAVICON'
}
},
before: [
ctx => {
if (!ctx.options.favicon.location) return false;
return modern(favicon(ctx.options.favicon.location))(ctx);
}
]
};

View File

@@ -0,0 +1,16 @@
const run = require('server/test/run');
const favicon = 'test/logo.png';
describe('Default modules', () => {
it('favicon', async () => {
const res = await run({ favicon }).get('/favicon.ico');
expect(res.headers['content-type']).toBe('image/x-icon');
});
// TODO: test for non-existing
// TODO: test different locations
// TODO: test for env
});