1.3.0 • Published 9 years ago

toa-favicon v1.3.0

Weekly downloads
43
License
-
Repository
github
Last release
9 years ago

toa-favicon

Favicon middleware for toa.

NPM version Build Status Downloads

toa

Demo

use as middleware:

const Toa = require('toa')
const favicon = require('toa-favicon')

const app = new Toa()
app.use(function () {
  this.body = 'Hi, toa-favicon!'
})

app.use(favicon('static/favicon.ico'))
app.listen(3000)

use as module:

const Toa = require('toa')
const favicon = require('toa-favicon')('examples')

const app = new Toa()
app.use(function *() {
  yield favicon
  this.body = 'Hi, toa-favicon!'
})

app.listen(3000)

Installation

npm install toa-favicon

API

const favicon = require('toa-favicon');

favicon(options)

Return a thunk function.

  • options.path (String) - The directory you wish to serve, default to process.cwd().
  • options.maxAge (Number) - Cache control max age (ms) for the files, default to 10 * 24 * 60 * 60 * 1000.

favicon('static') is equal to favicon({path: 'static'}).

favicon('static') is equal to favicon('static/favicon.ico').

favicon('static') is equal to favicon('process.cwd()/static/favicon.ico').

License

The MIT License (MIT)

1.3.0

9 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

11 years ago

1.0.2

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago