Closed mercmobily closed 5 years ago
I asked this more than 1 year ago... I did end up doing this: if (req.url.startsWith('/stores/')) return next(null)
but it feels terrible. Plus, /stores/
is not even the only one that gets filtered...
What's a sane way to deal with this?
I cannot reproduce this problem with the latest session. Closing for now.
Hi,
I am starting a new project, and I am using express-session for the first time. At the moment, I am doing app.use() like so:
}
The problem with this approach is that the session is created for each served file. In a conventional server, I would put the middleware for the session after the serving of static files. However, here node-prpl-server is dealing with static files -- and is in fact always serving something, effectively.
Now:
If I put
app.use(session({
afterapp.get('/*', prpl.makeHandler(
, mycargo
routes won't get the session information (which is necessary)If I put
app.use(session({
afterapp.get('/*', prpl.makeHandler(
at the beginning, before session and cargo routes, the module will always serve anything and everything.A possible "solution" I worked out is this:
Basically, I am leaving
/stores/*
out of the node-prpl equation.Questions:
1) Is this a sane way to go about it? 1a) I could probably place the conditional around
app.use(session({
2) Right now, every time a user logs in, the app greys out until an ajax call is completed and the user's config is retrieved. This is not ideal: it means that the user is greeted with a "loading" message (while the app retrieves the user config) plus all of the error management relating to this.
I was thinking of serialising the user's configuration within the served
index
page served by node-prpl. Is that advisable and indeed feasible? OR should index.html never change?