# properly-favicon

> middleware for handling favicons by routes

Latest version **0.1.1** (published 2017-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install properly-favicon
pnpm add properly-favicon
yarn add properly-favicon
bun add properly-favicon
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2017-10-18 |
| First published | 2017-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Keanu Pang |
| Maintainers | keanu |
| Keywords | express, favicon, middleware |

## Links

- npm: https://www.npmjs.com/package/properly-favicon
- Repository: https://github.com/KeanuPang/properly-favicon
- Homepage: https://github.com/KeanuPang/properly-favicon#readme
- Issues: https://github.com/KeanuPang/properly-favicon/issues
- npm.io page: https://npm.io/package/properly-favicon

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2017-10-18
- 0.1.0 — 2017-09-28

## README

# properly-favicon

Node.js middleware for serving favicons by routing.

## Usage

First, you need a express server with session enabled:

```
const session = require('express-session');
const sess = {
    secret: 'secret',
    cookie: {},
    resave: false,
    saveUninitialized: true
};
app.use(session(sess));
```

In express app, create a mapping table, to specify favicons according by routes, like this:

```
const mapping = {
    '/one': path.join(__dirname, 'public', 'favicon.ico'),
    '/two': path.join(__dirname, 'public', 'favicon2.ico'),
    '/three': path.join(__dirname, 'public', 'favicon3.ico')
};
```

Finally, mount properly-favicon in your app:

```
app.use(require('./properly-favicon')(mapping));
```

## Installation

```
npm install properly-favicon
```

## License

MIT

---
_Source: https://npm.io/package/properly-favicon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
