Skip to content

Node.js middleware to serve `favicon.ico` file.

License

Notifications You must be signed in to change notification settings

aarontravass/favicon

 
 

Repository files navigation

@tinyhttp/favicon

npm GitHub Workflow Status Coverage

A rewrite of serve-favicon module.

Node.js middleware to serve favicon.ico file.

Install

pnpm i @tinyhttp/favicon

API

import { favicon } from '@tinyhttp/favicon'

Options

favicon accepts these properties in the options object.

path

Path to icon, required. Passed as the first argument.

maxAge

Sets Cache-Control: maxAge= header, optional. Default is one year. Passed with object in the second argument.

Example

import { favicon } from '@tinyhttp/favicon'
import { createServer } from 'http'
import path from 'path'

createServer(favicon(path.join(process.cwd(), 'public', 'favicon.ico')).listen(3000)

About

Node.js middleware to serve `favicon.ico` file.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 85.9%
  • Shell 7.7%
  • JavaScript 6.4%