koa-index
v0.2.0
Published
Serve directory listings for Koa
Downloads
20
Readme
koa-index
Serve directory listings for Koa
Install
Screenshot
Usage
import Koa from 'koa'
import path from 'path'
import koaIndex from 'koa-index'
const app = new Koa()
app.use(
koaIndex(__dirname, {
hidden: true
})
)
app.listen(8080)
API
interface IOpts {
index?: string | boolean
directory?: boolean
maxAge?: number
lastModified?: boolean
etag?: boolean
hidden?: boolean
}
koaIndex(root: string, opts?: IOpts)
Options
- index: Default file name, defaults to
index.html
- directory: Support directory send, defaults to
true
- maxAge: cache control max age (in milliseconds) for the files, default to
0
- lastModified: Enable or disable Last-Modified header, defaults to
true
- etag: Enable or disable etag generation, defaults to
true
- hidden: Display hidden (dot) files. Defaults to
false
License
MIT