1.0.5 • Published 7 years ago

egg-public v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

egg-public

NPM version build status Test coverage David deps Known Vulnerabilities npm download

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.

License

MIT

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago