From 20c8aa903620c92191f2dd2dbeb580d457a3de40 Mon Sep 17 00:00:00 2001 From: Andre Vermeulen Date: Mon, 1 May 2017 15:02:27 +0200 Subject: [PATCH 1/6] Update readme.md --- readme.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 34a59b5..f26559c 100644 --- a/readme.md +++ b/readme.md @@ -51,6 +51,15 @@ Access the messages in your views via `locals.messages` (.jade in this case): span= messages.info ``` +Access messages in Handlebars views use `locals.messages`: + +```handlebars +
+

{{messages.info}}

+
+``` + + ## Requires * cookieParser @@ -79,4 +88,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 0dc235c4a079c952df80fb82c8f4f39c00c67bb8 Mon Sep 17 00:00:00 2001 From: Andre Vermeulen Date: Mon, 1 May 2017 15:03:56 +0200 Subject: [PATCH 2/6] Update readme.md --- readme.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index f26559c..7f0a564 100644 --- a/readme.md +++ b/readme.md @@ -54,12 +54,13 @@ Access the messages in your views via `locals.messages` (.jade in this case): Access messages in Handlebars views use `locals.messages`: ```handlebars + +{{#if messages.info}}

{{messages.info}}

+{{/if}} ``` - - ## Requires * cookieParser From 9c572e634a049aa1ea09490382395b9d30501f6c Mon Sep 17 00:00:00 2001 From: avermeulen Date: Mon, 11 Jun 2018 12:27:31 +0200 Subject: [PATCH 3/6] changed http-session setup --- readme.md | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/readme.md b/readme.md index 7f0a564..4769ea2 100644 --- a/readme.md +++ b/readme.md @@ -9,22 +9,28 @@ ## Installation - Works with Express 3.x.x - - npm install git://github.com/RGBboy/express-flash.git + Works with Express 3.x.x+ + `npm install git://github.com/RGBboy/express-flash.git` ## Usage Set it up the same way you would `connect-flash`: ``` javascript - var flash = require('express-flash'), - express = require('express'), - app = express(); - - app.use(express.cookieParser('keyboard cat')); - app.use(express.session({ cookie: { maxAge: 60000 }})); + let flash = require('express-flash'); + let express = require('express'); + let session = require('express-session'); + let app = express(); + + // initialise session middleware - flash-express depends on it + app.use(session({ + secret : "", + resave: false, + saveUninitialized: true + })); + + // initialise the flash middleware app.use(flash()); ``` @@ -43,30 +49,21 @@ Use `req.flash()` in your middleware }); ``` -Access the messages in your views via `locals.messages` (.jade in this case): - -``` jade - - if (messages.info) - .message.info - span= messages.info -``` - Access messages in Handlebars views use `locals.messages`: ```handlebars - {{#if messages.info}}

{{messages.info}}

{{/if}} ``` + ## Requires - * cookieParser - * session + * session - http-session middleware - install it using `npm install --save express-session` -## License +## License (The MIT License) From d61364fbae2ed7603107aafdb35d834e3f4d50e3 Mon Sep 17 00:00:00 2001 From: Andre Vermeulen Date: Sun, 5 Aug 2018 17:02:34 +0200 Subject: [PATCH 4/6] Update readme.md --- readme.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 4769ea2..7f95b9f 100644 --- a/readme.md +++ b/readme.md @@ -18,10 +18,10 @@ Set it up the same way you would `connect-flash`: ``` javascript - let flash = require('express-flash'); - let express = require('express'); - let session = require('express-session'); - let app = express(); + const flash = require('express-flash'); + const express = require('express'); + const session = require('express-session'); + const app = express(); // initialise session middleware - flash-express depends on it app.use(session({ From b37f44dbc0ac7f0eaba1bf11abcb7ccb3c52e3cd Mon Sep 17 00:00:00 2001 From: Andre Vermeulen Date: Sun, 5 Aug 2018 17:30:48 +0200 Subject: [PATCH 5/6] Update readme.md --- readme.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 7f95b9f..dfcd370 100644 --- a/readme.md +++ b/readme.md @@ -9,9 +9,13 @@ ## Installation - Works with Express 3.x.x+ +Install it using: + +``` +npm install --save express-flash +npm install --save express-session +``` - `npm install git://github.com/RGBboy/express-flash.git` ## Usage From c8e69e0f736eb72e5e011c29831f493100ba5e4e Mon Sep 17 00:00:00 2001 From: Andre Vermeulen Date: Sun, 19 Aug 2018 16:54:48 +0200 Subject: [PATCH 6/6] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index dfcd370..2b0154b 100644 --- a/readme.md +++ b/readme.md @@ -23,8 +23,8 @@ npm install --save express-session ``` javascript const flash = require('express-flash'); - const express = require('express'); const session = require('express-session'); + const express = require('express'); const app = express(); // initialise session middleware - flash-express depends on it