Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentaition is not noob friendly... #12

Open
ghost opened this issue Jan 8, 2022 · 1 comment
Open

Documentaition is not noob friendly... #12

ghost opened this issue Jan 8, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 8, 2022

I am trying to wrap my head around how to use this library and can't. I believe I am missing some common knowledge, so it is my fault, but throwing in a couple of links to give direction would probably help others like me. I don't even know what to look. Specifically I am stuck trying to understand how to re-attach the session to the request when it comes the second time.

@harishanchu
Copy link
Member

You have to do following step only once when you boot your application:

// init
session = new NodeSession({secret: 'Q3UBzdH9GEfiRCTKbi5MTPyChpzXLsTD'});

Then you just have to call session.startSession(req, res, callback) in an HTTP middleware for each request. If the session has already been initiated for a user it will be read a reattached by reading the details from cookies.

I hope now you are clear about what needs to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant