@medley/serve-favicon

v0.1.2
Medley plugin for serving the default favicon
serve favicon medley

@medley/serve-favicon

npm Version Build Status Coverage Status dependencies Status

Medley plugin for serving the default favicon (/favicon.ico).

Installation

npm install @medley/serve-favicon --save
# or
yarn add @medley/serve-favicon

Usage

const medley = require('@medley/medley');
const path = require('path');

const app = medley();

app.register(require('@medley/serve-favicon'), {
  favicon: path.join(__dirname, 'public', 'favicon.ico')
});

Plugin Options

favicon (required)

Type: string | Buffer

Either a path string pointing to the favicon file or a Buffer containing the favicon file.

// Using a path string
app.register(require('@medley/serve-favicon'), {
  favicon: path.join(__dirname, 'path/to/favicon.ico')
});

// Using a Buffer
app.register(require('@medley/serve-favicon'), {
  favicon: fs.readFileSync('./path/to/favicon.ico')
});

maxAge

Type: number
Default: 31536000 (1 year)

A number in seconds indicating how long browsers should cache the favicon.

app.register(require('@medley/serve-favicon'), {
  favicon: path.join(__dirname, 'public', 'favicon.ico'),
  maxAge: 60 * 60 * 24 * 7 // 1 week
});
npm i @medley/serve-favicon

Metadata

  • MIT
  • >=6
  • Nathan Woltman
  • released 7/1/2019

Downloads

Maintainers