Fastify Plugin to serve default favicon
Clone or download
Permalink
Failed to load latest commit information.
example log a warning when custom favicon is not found, and update the exampl… May 17, 2018
test add a test to check/ensure that it will be returned default favicon b… May 19, 2018
.dockerignore checkout from Mac, adjust line endings May 13, 2018
.editorconfig checkout from Mac, adjust line endings May 13, 2018
.gitignore checkout from Mac, adjust line endings May 13, 2018
.npmignore
CHANGELOG.md update changelog for the release May 19, 2018
LICENSE checkout from Mac, adjust line endings May 13, 2018
NOTICE checkout from Mac, adjust line endings May 13, 2018
README.md checkout from Mac, adjust line endings May 13, 2018
favicon.ico add Fastify favicon and related attributions and license; update my s… Feb 17, 2018
package.json change dev dependency from 'request' to 'simple-get' and update tests… May 19, 2018
plugin.js log a warning when custom favicon is not found, and update the exampl… May 17, 2018

README.md

fastify-favicon

Fastify Plugin to serve default favicon.

With this plugin, Fastify will have a route configured for /favicon.ico requests.

Usage

const fastify = require('fastify')()

// example without specifying options, searching favicon.ico from project root, otherwise returning a default favicon
fastify.register(require('fastify-favicon'))
// or
// example with custom path, usually relative to project root, but could be absolute
fastify.register(require('fastify-favicon'), { path: './test' })

fastify.listen(3000)
// curl http://127.0.0.1:3000/favicon.ico => returning the image, and no error thrown

Requirements

Fastify 0.43.0 or later.

License

Licensed under Apache-2.0.