# smz-flash

> Flash data for Express.js

Latest version **1.0.0** (published 2020-07-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install smz-flash
pnpm add smz-flash
yarn add smz-flash
bun add smz-flash
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-07-16 |
| First published | 2020-07-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sacha-Maximilien Zacaropoulos |
| Maintainers | sacha-smz |
| Keywords | flash, express, session |

## Links

- npm: https://www.npmjs.com/package/smz-flash
- Repository: https://github.com/sacha-smz/smz-flash
- Homepage: https://github.com/sacha-smz/smz-flash#readme
- Issues: https://github.com/sacha-smz/smz-flash/issues
- npm.io page: https://npm.io/package/smz-flash

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-07-16

## README

# Flash data for Express.js

Express middleware that allows you to store data in the session that will be available only for the next request

## Usage

```sh
npm i smz-flash
```

```js
// index.js

const express = require("express");
const session = require("express-session");
const flash = require("smz-flash");

const app = express();

app.use(
  session({
    // options
  })
);

app.use(flash);

// ...
```

```js
// controller.js

controller.doSmth = (req, res) => {
  if (sthBadHappens) {
    req.flash.error = "Something bad happened";
    res.redirect("back");
  }
};
```

```js
// next-request-controller.js

controller.showSmth = (_, res) => {
  res.render("myView");
};
```

```js
// myView.ejs

<% if(locals.error) { %>
  <p><%= error %></p>
} %>
```

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