版权声明:本文为博主原创文章,未经博主允许不得转载,转载请注明地址。 https://blog.csdn.net/qq_33589252/article/details/85259677
废话少说,直接上代码:(我是通过这篇文章来骗访问量的,哈哈哈哈哈哈哈哈嗝),谢谢大家惹~
'use strict';
const path = require('path');
module.exports = appInfo => {
const exports = {};
/**
* Static file serve
*
* @member Config#static
* @property {String} prefix - `/public/` by default
* @property {String} dir - static files store dir, `${baseDir}/app/public` by default
* @property {Number} maxAge - cache max age, default is 0
* @see https://github.com/koajs/static-cache
*/
exports.static = {
prefix: '/public/',
dir: path.join(appInfo.baseDir, 'app/public'),
// support lazy load
dynamic: true,
preload: false,
buffer: false,
maxFiles: 1000,
};
return exports;
};