1. 程式人生 > >egg的static的字首是可以修改惹,靴靴

egg的static的字首是可以修改惹,靴靴

廢話少說,直接上程式碼:(我是通過這篇文章來騙訪問量的,哈哈哈哈哈哈哈哈嗝),謝謝大家惹~

'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;
};