egg-index

support index.html for egg-static

Usage no npm install needed!

<script type="module">
  import eggIndex from 'https://cdn.skypack.dev/egg-index';
</script>

README

egg-index · GitHub license npm version npm downloads PRs Welcome

Support index.html for egg-static.

  • egg-static base on koa/static-cache.
  • egg-index: web homepage support, eg, / to /index.html.

Installation

npm install egg-index
// config/plugin.js
exports.index = {
  enable: true,
  package: 'egg-index',
};

Configuration

exports.idex = {
  // option, default to 'index.html'
  filename: 'index.html'
};

exports.static = {
  prefix: '/'
  dir: path.resolve('./myWeb'),
};

Now, available to access ./myWeb/index.html from '/'