1.0.5 • Published 7 years ago
egg-public v1.0.5
egg-public
Static server plugin for egg, base on koa-static-cache.
This Project is fork from https://github.com/eggjs/egg-static.
Install
$ npm i egg-public --save
Usage
// {app_root}/config/plugin.js
exports.public = {
enable: true,
package: 'egg-public',
};
Configuration
// {app_root}/config/config.default.js
exports.public = {
prefix: '/public/',
dir: path.join(appInfo.baseDir, 'app/public'),
// support lazy load
dynamic: true,
preload: false,
buffer: false,
maxFiles: 1000,
};
// {app_root}/config/config.default.js
exports.public = {
prefix: '/public/',
dir: [
// this will override the default
{
prefix: '/static',
dir: path.join(appInfo.baseDir, 'app/public')
},
{
prefix: '/static2',
dir: 'xxxxxxxxxxx',
}
]
// support lazy load
dynamic: true,
preload: false,
buffer: false,
maxFiles: 1000,
};
see config/config.default.js for more detail.
Example
Questions & Suggestions
Please open an issue here.