|
1 year ago | |
---|---|---|
.. | ||
app | 1 year ago | |
config | 1 year ago | |
node_modules | 1 year ago | |
History.md | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
app.js | 1 year ago | |
package.json | 1 year ago |
Static server plugin for egg, base on koa-static-cache.
egg-static
is a plugin that has been built-in for egg. It is enabled by default.
egg-static support all configurations in koa-static-cache. and with default configurations below:
'/public/'
path.join(appInfo.baseDir, 'app/public')
true
false
31536000
in prod env, 0
in other envstrue
in prod env, false
in other envsegg-static
provides one more option:
1000
.All static files in $baseDir/app/public
can be visited with prefix /public
, and all the files are lazy loaded.
egg-static
will cache the assets after visited, you need to restart the process to update the assets.$baseDir/app/public
but you can also define multiple directory by use dir: [dir1, dir2, ...]
or dir: [dir1, { prefix: '/static2', dir: dir2 }]
, static server will use all these directories.// {app_root}/config/config.default.js
exports.static = {
// maxAge: 31536000,
};
Please open an issue here.