totaljs / framework

Node.js framework
http://www.totaljs.com
Other
4.36k stars 450 forks source link

Set session cookies with no expiration date #669

Closed fgnm closed 6 years ago

fgnm commented 6 years ago

I need to create a session cookie, so no expiration date should be included in the cookie string. However (even check the code) it seems that Total.js does not support session cookies.

Is there any way to do this?

petersirka commented 6 years ago

Hi @fgnm, try this:

controller.cookie('name', 'value');
// or
contorller.cookie('name', 'value', null);
fgnm commented 6 years ago

Thank you so much!

controller.cookie('name', 'value');

Worked as expected. Anyway I'd like to suggest to add this in the docs: https://docs.totaljs.com/latest/en.html#api~FrameworkController~controller.cookie Because "expiration" is not marked as optional, this could make confusion :)

petersirka commented 6 years ago

Yes, there is missing, but I have added it. I want to publish a new version of Total.js next week, so then will be updated docs.

Thank you!