Here is some sample code that outlines my issue. I’m trying to get express-session / connect-session-sequelize to work for a website with login functionalities.
I am using express-session and express-mysql-session in my app to generate sessions and store them in mysql database. Sessions are stored in a table called sessions.
I need to know if my user is connected or not. For that I want to read the cookies that I set in the server side with express-session :
I have a React App making calls to an API in node.js/Express.
I’m trying to use the express-session library in my MERN stack app along with socket.io for the real time messaging part of the app.
I need to build an architecture for a SaaS system, which will be separated to a few lambda functions on the backend, and one of them is a sign in / sign up service, which should verify user credentials and in case of a success create a session and return it to a user using a session cookie.
First of all, I thought of using a server so I can achieve a single entry point to the backend and will forward the requests to the lambdas endpoints.
I ran a
console.log(req); to see what was there and found that the data from the DB is shown together with the session data
When I go to server adress (so I’m using get method) it is working as I would want it to work, the sessionID doesn’t change upon HTTP requests, but when I’m using client’s
fetch method to get to the server adress, the sessionID always changes and that is defect, what I don’t want.
I was experimenting with NodeJs with Session. I followed code from many sites. Simplest one I would like to mentioned is
Sample NodeJS Code for session management with Redis
I noticed how some people do this. It got me wondering if it is beneficial. For instance, I check if a given condition is met by either of the properties of a session. Then this is done again, separately for each property of the object.