Express middleware for storing messages in the session. Connect-flash was part of Express until Express 3. connect-flash
Questions tagged [connect-flash]
107 questions
15
votes
2 answers
difference between flash, connect-flash and express-flash
I'm still kinda confused on what exactly is the difference between flash, connect-flash and express-flash.
Installation:
flashnpm install flash
express-flash : npm install express-flash
connect-flash :npm install connect-flash
Usage:
flash:…

antzshrek
- 9,276
- 5
- 26
- 43
15
votes
1 answer
How do I display flash message without page refresh using express and connect-flash?
Express connect-flash displays only after refresh. Code is stripped for easy reading.
"express": "~4.2.0",
"connect-flash": "~0.1.1",
And here is my app.js
var express = require('express'),
favicon = require('serve-favicon'),
flash =…

niksmac
- 2,667
- 3
- 34
- 50
9
votes
3 answers
TypeError: req.flash is not a function
When I tried to log in from page, I got error return done(null, false, req.flash('loginMessage', 'User does not exist')); TypeError: req.flash is not a function.
Below are my server.js and passport.js configuration:
server.js:
var express =…

user3330383
- 171
- 1
- 2
- 6
8
votes
2 answers
Express: req.flash() requires sessions
I'm having some problems getting connect-flash to work, the error message I'm getting is:
'Error: req.flash() requires sessions'
I've seen this can be because of the ordering of the app, but I'm not sure if this is the case here.
App.js:
var…

Ash
- 6,483
- 7
- 29
- 37
6
votes
2 answers
Catch/Handle MySQL Duplicate Entry Error - with NodeJS, PassportJS, Express, connect-flash, Heroku
I am doing user registration for a node app, starting from this example, but using a MySQL database instead of MongoDB. Multiple columns in the users table have a uniqueness constraint.
Here is the SQL code that creates the table:
CREATE TABLE `' +…

user1147171
- 1,213
- 3
- 14
- 22
5
votes
1 answer
How to get equivalent of "req.something" from in angular with nodejs
I'm following a tutorial on how to set up authentication with nodejs and passport. (http://scotch.io/tutorials/javascript/easy-node-authentication-setup-and-local)
The tutorial has me rendering templates with ejs and passing in flash data.
Instead…

Shane Drye
- 93
- 3
4
votes
1 answer
Jade html not updated after a redirect in Express.js
I'm currently having some trouble displaying a flash message in Express.js using Jade's templating engine and connect-flash. I am simply trying to flash an error message when the user tries to add a new User object to my database that already…

Jeremy Dennen
- 172
- 1
- 10
4
votes
2 answers
Alert message with Connect-flash and Jade
I'm building a site with login authentication using node.js, express, and Passport. For the signup page, I want the site to send a message when a username is already taken, right now the following code is working just fine, but I'd like to add an…

asantiagot
- 153
- 2
- 12
3
votes
1 answer
flash message in passport js
I have a problem with flash messages. I do not get an error messages on my page. please tell me where the error.
PS. Sorry for my English ;D
app.js
require: express, passport, pug, express-session, cookie-parser, connect-flash, body-parser...
var…

ch9ch9n
- 33
- 1
- 6
3
votes
2 answers
Display flash messages with Passport.js
I'm having trouble displaying flash messages while using Passport.js in Express 4. The Passport.js local strategy documentation shows how to set the flash message, but not much about how to actually display it.
Here's how I've been doing…

starleaf1
- 2,701
- 6
- 37
- 66
3
votes
0 answers
Send data to angularjs from nodejs for flash-message
Like we send data from nodejs to ejs templete
server.js
app.get('/login', function(req, res) {
res.render('login.ejs', { message: req.flash('loginMessage') });
});
login.ejs
<% if (message.length > 0) { %>

surazzarus
- 772
- 5
- 17
- 32
3
votes
1 answer
connect-flash message with HTML?
I would like to include a link in the text of a connect-flash message:
JS
req.flash("registerMessage", "Sorry, the User ID you chose is already in use. Please choose another. If you have already registered and need assistance logging in,

peteallen
- 2,553
- 2
- 17
- 16
2
votes
1 answer
Should you use Req.app.locals to store flash messages?
Is it safe to use req.app.locals to store req.flash messages? (using connect-flash)
With some research and some testing, I understand that req.app.locals is a global variable and not user specific, while req.flash is stored in the session so it is…

Ari Baranian
- 55
- 1
- 3
2
votes
1 answer
Error message with connect-flash: flash is not defined
I'm reading a books about node.js, express and mongodb. The author uses connect-flash. However, I can't seem to get it to work correctly. The folders in which connect-flash is used is shown below with the irrelevant code removed.
index.js
const…

Simple
- 437
- 7
- 19
2
votes
0 answers
How to iterate and show validation errors messages in ejs template?
I created express app and implemented flash message. Now when i get the flash messages from validation errors I am passing that messages to view. But when i try to get the messages in the view I am not able to see since app showing bunch of error…

Arun kumar
- 1,041
- 5
- 20
- 39