Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
81 views

Express Session manually assign session

Something I don't understand about the express session middleware is the reassignment of sessions. E.g. When someone opens my page for the first time, the middleware will create a fresh new session ...
GreenSaiko's user avatar
0 votes
0 answers
12 views

middleware order confusion over an express application

I have these middlewares in the yelp app in this order (assuming order matters): app.set('view engine', 'ejs'); app.use(bodyParser.urlencoded({ extended: false })); app.use(methodOverride('_method')...
omar watad's user avatar
0 votes
0 answers
48 views

In a node.js + express application, use a proxy route as middleware for another proxy

I have a node.js app with an api-gateway that routes to several microservices. One of the microservices is the authentication microservice. I want to use the route auth/verifySession to check if the ...
Vaprus's user avatar
  • 1
2 votes
1 answer
3k views

Express sessions not persisting after redirect in node.js

Using node.js and pgAdmin. I have set up all the necessary code for a server, sessions, cookies, and all that. The error I'm getting is "TypeError: Cannot read property 'username' of undefined&...
Link's user avatar
  • 45
0 votes
2 answers
155 views

Can fs.writeFile called in a file routed to express, middlewared by session, delete the session cookie?

I routed a js file to the main js file using express and it's router middleware. Also each path is middlewared by session. After authentication, a get request which is received only when req.session....
Oren Sayag's user avatar
0 votes
1 answer
258 views

Node express server session management middleware?

I want to do only cookie based authentication for my app. No pwd or email need to be given. It is like the guest user feature in some webapps (like discord). You can use the app like a logged in user ...
Mani Bharathy's user avatar
1 vote
0 answers
18 views

Express app, sessions and legal implications

How do I implement sessions in an Express app, and are there any legal implications of doing so? I've tried googling the answer, but it seems that there are a lot of different approaches. What would ...
Sam_Francis_Baker's user avatar
0 votes
1 answer
28 views

require method called by function not working

I ran into this while setting some middleware only for certain routes. In my application, I only need session and csrf on my contact page. Here's the problem. When I require them outside and use the ...
donnyjeremiah's user avatar
0 votes
1 answer
1k views

ExpressJS session save in cookie

I want create session cookie for track user in site. For this purposes I use "express-session" middleware: var express = require('express'); var session = require('express-session'); app.use(session(...
Sergey B. Hizof's user avatar
1 vote
1 answer
470 views

Cannot get session data from middleware in node.js

I have a function that gets the id of the user when she registers user.save(function(err, id){ if(err) return next(err); req.session.uid=id; ...
slevin's user avatar
  • 4,338
9 votes
1 answer
14k views

Node, express.session as middleware does not set cookie

this question is related to NodeJS + Express - Apply session middleware to some routes which I first thought would solve my problem. But it did not. I'm trying to build a site where the first default-...
northmoose's user avatar
0 votes
2 answers
175 views

Why does this flash policy module (express middleware) use _.clone() in Sails.js?

From a tutorial on Sails, this is a Sails policy - essentially Express middleware: module.exports = function(req, res, next) { res.locals.flash = {}; if (!req.session.flash) return next(); ...
dsp_099's user avatar
  • 6,091
0 votes
1 answer
123 views

Do I need to authenticate session data in Express middleware?

Currently my authentication middleware for my Express 3.0 app looks something like this: return function (req, res, next) { if (!isProtected(req.path)) { debug('Allowed path "' + req.path ...
Cory Gross's user avatar
  • 37.2k
1 vote
0 answers
661 views

why is my express middleware session undefined?

I'm trying to use the express middleware for sessions (I'm not understanding but I feel that I am very close). the reason I have ended up asking is that the express docs (http://expressjs.com/api....
Ben Muircroft's user avatar
51 votes
2 answers
10k views

What is the difference between 'session' and 'cookieSession' middleware in Connect/Express?

There are two session-related middleware packages bundled with Connect/Express. What is the difference? How do I choose? I'm assuming that session middleware is the same as cookieSession middleware - ...
gfaceless's user avatar
  • 1,559
9 votes
1 answer
24k views

Node.js - Issue with res.redirect in middleware

I'm trying to use a authenticateUser() middleware before loading all of my pages. Instead of including it in each call (as in app.get('/', authenticateUser, function()...)), I tried setting it with ...
Varun Singh's user avatar
  • 1,706
0 votes
1 answer
2k views

Can't set session property in an Express Route Middleware [closed]

I'm currently developing an API using NodeJS and Express. var express = require('express'); var app = express.createServer(); app.configure(function() { app.use(express.cookieParser()); app.use(...
Francesc's user avatar
  • 1,349