reed-koa-static

1.0.1 • Public • Published

Reed Koa Static

Rule based koa static file server middleware

Sample

    const static = require('reed-koa-static')

    const app = new Koa()

    //rule could comes form config file
    const rule = {
        urlPrefix: 'foo',
        dirPath: 'static',
        // indexPages: ['index.html', 'index.htm']
    }

    app.use(static(rule))

    return app.listen(8000)

Options

urlPrefix: [Optional] Set the URL path prefix

dirPath: [Required] Dir path to the static files

indexPages: [Optional] Set the index page array, default value is ['index.html', 'index.htm']

Package Sidebar

Install

npm i reed-koa-static

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

3.69 kB

Total Files

4

Last publish

Collaborators

  • hanshuang