[FAQ] eggjs/egg 自定义 favicon.ico

 

通过llama.cpp与羊驼聊天的网页界面- 详解 Serge 的启动使用

 

从  egg 项目配置里找到这一段代码:

https://github.com/eggjs/egg/blob/master/config/config.default.js#L205C21-L205C74

  /**
   * The option of `siteFile` middleware
   *
   * You can map some files using this options, it will response immdiately when matching.
   *
   * @member {Object} Config#siteFile - key is path, and value is url or buffer.
   * @property {String} cacheControl - files cache , default is public, max-age=2592000
   * @example
   * // specific app's favicon, => '/favicon.ico': 'https://eggjs.org/favicon.ico',
   * config.siteFile = {
   *   '/favicon.ico': 'https://eggjs.org/favicon.ico',
   * };
   */
  config.siteFile = {
    '/favicon.ico': fs.readFileSync(path.join(__dirname, 'favicon.png')),
    // default cache in 30 days
    cacheControl: 'public, max-age=2592000',
  };

 然后在自己项目的 config.default.js 里照着加上就行,注意头部引入了 fs 和 path 这两个库。

 

Other: HTTP安全报头检测

Link:https://www.cnblogs.com/farwish/p/17726267.html

posted on 2023-09-24 17:17  ercom  阅读(54)  评论(0编辑  收藏  举报