egg-static 如何配置可以支持多个目录

Created on 16 Jun 2017  ·  4Comments  ·  Source: eggjs/egg

我现在想把 public/admin 映射到 http://localhost/admin 、 public/view 映射到 http://localhost/ 我该怎么做呢?

Most helpful comment

@gongchao 有几种实现的方式

  1. prefix 设置为 ‘/’, public/view 的文件放到 public 根目录中。
  2. 使用 okoala/egg-multiple-static 这个包,支持多个目录分别映射。

All 4 comments

@gongchao 有几种实现的方式

  1. prefix 设置为 ‘/’, public/view 的文件放到 public 根目录中。
  2. 使用 okoala/egg-multiple-static 这个包,支持多个目录分别映射。

为什么要 「public/view 映射到 http://localhost/」?不考虑 router 了么?

你们只是做纯静态页面么?

我会建议你们的 view 是用模板引擎渲染出来的。

@okoala 🙏 Thk 正需要~

@atian25 明白了

Was this page helpful?
0 / 5 - 0 ratings