Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koajs/favicon
Koa middleware for serving a favicon
https://github.com/koajs/favicon
Last synced: 2 days ago
JSON representation
Koa middleware for serving a favicon
- Host: GitHub
- URL: https://github.com/koajs/favicon
- Owner: koajs
- Created: 2013-09-14T03:58:07.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-04-24T20:43:09.000Z (8 months ago)
- Last Synced: 2024-10-29T15:32:17.534Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 104
- Watchers: 7
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
- awesome-koa - favicon - Koa middleware for serving a favicon (Middleware)
- awesome-koa - koa-favicon - 基于 `serve-favicon`提供网站图标服务favicon。 ![](https://img.shields.io/github/stars/koajs/favicon.svg?style=social&label=Star) ![](https://img.shields.io/npm/dm/koa-favicon.svg?style=flat-square) (仓库 / 中间件)
README
# koa-favicon [![Build Status](https://travis-ci.org/koajs/favicon.svg)](https://travis-ci.org/koajs/favicon)
Koa middleware for serving a favicon. Based on [serve-favicon](https://github.com/expressjs/serve-favicon).
## Installation
```js
$ npm install koa-favicon
```## Example
```js
const Koa = require('koa');
const favicon = require('koa-favicon');
const app = new Koa();app.use(favicon(__dirname + '/public/favicon.ico'));
```## API
### favicon(path, [options])
Returns a middleware serving the favicon found on the given `path`.
#### options
- `maxAge` cache-control max-age directive in ms, defaulting to 1 day.
- `mime` specify the mime-type of the favicon, defaults to "image/x-icon"## License
MIT