fastify-favicon

Fastify plugin to serve default favicon requests

Usage no npm install needed!

<script type="module">
  import fastifyFavicon from 'https://cdn.skypack.dev/fastify-favicon';
</script>

README

fastify-favicon

NPM Version NPM Downloads Code Style Coverage Status dependencies Status devDependencies Status

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),
// and custom name; both options are optional
fastify.register(require('fastify-favicon'), { path: './test', name: 'icon.ico' })

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

Requirements

Fastify ^3.0.0 , Node.js 10.13.x or later. Note that plugin releases 2.x are for Fastify 2.x, 3.x are for Fastify 3.x, etc.

Note

Nothing.

Contributing

  1. Fork it ( https://github.com/smartiniOnGitHub/fastify-favicon/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

Licensed under Apache-2.0.