session-flash 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +23 -34
  3. package/package.json +1 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2012-2013 Jared Hanson
3
+ Copyright (c) 2012–2026
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -1,36 +1,42 @@
1
- # connect-flash
1
+ # session-flash
2
2
 
3
3
  The flash is a special area of the session used for storing messages. Messages
4
4
  are written to the flash and cleared after being displayed to the user. The
5
5
  flash is typically used in combination with redirects, ensuring that the message
6
6
  is available to the next page that is to be rendered.
7
7
 
8
- This middleware was extracted from [Express](http://expressjs.com/) 2.x, after
9
- Express 3.x removed direct support for the flash. connect-flash brings this
10
- functionality back to Express 3.x, as well as any other middleware-compatible
11
- framework or application. +1 for [radical reusability](http://substack.net/posts/b96642/the-node-js-aesthetic).
12
8
 
13
9
  ## Install
14
10
 
15
- $ npm install connect-flash
11
+ npm i session-flash
16
12
 
17
13
  ## Usage
18
14
 
19
- #### Express 3.x
15
+ #### Express 5.x
20
16
 
21
17
  Flash messages are stored in the session. First, setup sessions as usual by
22
18
  enabling `cookieParser` and `session` middleware. Then, use `flash` middleware
23
- provided by connect-flash.
19
+ provided by session-flash.
24
20
 
25
21
  ```javascript
26
- var flash = require('connect-flash');
27
- var app = express();
22
+ const app = express();
23
+ const cookieParser = require('cookie-parser');
24
+ const session = require('express-session');
25
+ const flash = require('session-flash');
26
+
27
+ app.use(cookieParser());
28
+
29
+ app.use(session({
30
+ secret: 'session-secret',
31
+ resave: false,
32
+ saveUninitialized: false,
33
+ cookie: { maxAge: 60000 }
34
+ }));
35
+
36
+ app.use(flash());
37
+
38
+
28
39
 
29
- app.configure(function() {
30
- app.use(express.cookieParser('keyboard cat'));
31
- app.use(express.session({ cookie: { maxAge: 60000 }}));
32
- app.use(flash());
33
- });
34
40
  ```
35
41
 
36
42
  With the `flash` middleware in place, all requests will have a `req.flash()` function
@@ -49,25 +55,8 @@ app.get('/', function(req, res){
49
55
  });
50
56
  ```
51
57
 
52
- ## Examples
53
-
54
- For an example using connect-flash in an Express 3.x app, refer to the [express3](https://github.com/jaredhanson/connect-flash/tree/master/examples/express3)
55
- example.
56
-
57
- ## Tests
58
-
59
- $ npm install --dev
60
- $ make test
61
-
62
- [![Build Status](https://secure.travis-ci.org/jaredhanson/connect-flash.png)](http://travis-ci.org/jaredhanson/connect-flash)
63
-
64
- ## Credits
65
-
66
- - [Jared Hanson](http://github.com/jaredhanson)
67
- - [TJ Holowaychuk](https://github.com/visionmedia)
68
-
69
58
  ## License
70
59
 
71
- [The MIT License](http://opensource.org/licenses/MIT)
60
+ [The MIT License]
72
61
 
73
- Copyright (c) 2012-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
62
+ Copyright (c) 2012-2026
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "session-flash",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Flash message middleware for Express sessions",
5
5
  "keywords": [
6
6
  "session",