0.2.0 • Published 3 years ago

koa-index v0.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

koa-index

Commitizen friendly

Serve directory listings for Koa

Install

NPM

Screenshot

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

0.2.0

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago