# koa-better-flash

> Flash message middleware for Koa and Passport

Latest version **0.0.4** (published 2019-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-better-flash
pnpm add koa-better-flash
yarn add koa-better-flash
bun add koa-better-flash
```

## 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.0.4 |
| Published | 2019-12-10 |
| First published | 2017-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.x |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Nick Baugh |
| Maintainers | niftylettuce |
| Keywords | connect, cookie, cookies, express, flash, info, koa-better-flash, kue, lass, messaging, node, queue, redis, sessions |

## Links

- npm: https://www.npmjs.com/package/koa-better-flash
- Repository: https://github.com/niftylettuce/koa-better-flash
- Issues: https://github.com/niftylettuce/koa-better-flash/issues
- npm.io page: https://npm.io/package/koa-better-flash

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2019-12-10
- 0.0.3 — 2017-09-05

## README

# koa-better-flash

[![build status](https://semaphoreci.com/api/v1/niftylettuce/koa-better-flash/branches/master/shields_badge.svg)](https://semaphoreci.com/niftylettuce/koa-better-flash)
[![code coverage](https://img.shields.io/codecov/c/github/niftylettuce/koa-better-flash.svg)](https://codecov.io/gh/niftylettuce/koa-better-flash)
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://github.com/lassjs/lass)
[![license](https://img.shields.io/github/license/niftylettuce/koa-better-flash.svg)](<>)

> Flash message middleware for Koa and Passport


## Table of Contents

* [Install](#install)
* [Usage](#usage)
* [Contributors](#contributors)
* [License](#license)


## Install

[npm][]:

```sh
npm install koa-better-flash
```

[yarn][]:

```sh
yarn add koa-better-flash
```


## Usage

```js
const Koa = require('koa');
const Router = require('koa-router');
const session = require('koa-generic-session');
const flash = require('koa-better-flash');

const app = new Koa();
const router = new Router();

router.post('/', (ctx, next) => {
  // you can also pass an array of messages:
  // ctx.flash('info', [ 'hi', 'hello', 'good morning' ]);
  ctx.flash('info', 'hello world');
  ctx.status = 200;
});

router.get('/', ctx => {
  // to get all messages by type simply call `ctx.flash()`
  ctx.body = ctx.flash('info');
  // outputs: [ 'hello world ']
});

app.keys = [ 'keys' ];
app.use(session());
app.use(flash());
app.use(router.routes());
app.listen();
```


## Contributors

| Name           | Website                    |
| -------------- | -------------------------- |
| **Nick Baugh** | <http://niftylettuce.com/> |


## License

[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)


## 

[npm]: https://www.npmjs.com/

[yarn]: https://yarnpkg.com/

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