1 | ;
|
2 |
|
3 | const path = require('path');
|
4 |
|
5 | module.exports = appInfo => {
|
6 | const exports = {};
|
7 |
|
8 | /**
|
9 | * Static file serve
|
10 | *
|
11 | * @member Config#static
|
12 | * @property {String} prefix - `/public/` by default
|
13 | * @property {String} dir - static files store dir, `${baseDir}/app/public` by default
|
14 | * @property {Number} maxAge - cache max age, default is 0
|
15 | * @see https://github.com/koajs/static-cache
|
16 | */
|
17 | exports.static = {
|
18 | prefix: '/public/',
|
19 | dir: path.join(appInfo.baseDir, 'app/public'),
|
20 | // support lazy load
|
21 | dynamic: true,
|
22 | preload: false,
|
23 | buffer: false,
|
24 | };
|
25 | return exports;
|
26 | };
|