An Interest In:
Web News this Week
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
April 18, 2022 08:03 pm GMT
Original Link: https://dev.to/mybytecode/how-to-set-cookie-using-expressjs-response-55k1
How to set cookie using ExpressJS response.
What is cookie?
Cookies is simple key value pair stored by web server on clients browser to store/maintain users state.
How it is different from Localstorage?
Locastorage can also be used to store users state, but cookies has more advanced configurations like expiration time, same site, secure flag, Httponly, etc. By using these advanced configurations we can programatically manage users state. It is considered that cookies are more secure than Localstorage in terms of handling user session or secret values like authentication tokens.
What is Httponly cookie?
A Httponly cookie is a simple cookie which is set by server with httponly flag as true which cannot be accessed by client side javascript.
Example
If you want to learn more, reach out to me at https://twitter.com/akshay_nocode
Original Link: https://dev.to/mybytecode/how-to-set-cookie-using-expressjs-response-55k1
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To