DEV Community

Cover image for What is Cookies All about HTTP(Part 2)
Nikhil Bobade
Nikhil Bobade

Posted on

What is Cookies All about HTTP(Part 2)

HTTP Cookies

HTTP cookies are known as a web cookie, Internet cookies, browser cookies. in the cookie, we can store a small piece of data that server send to your browser.

Cookies are useful for Auth cookie tokens, to store in small text files, user preferences, color themes, game scores for many things you can use HTTP cookies. Its very easy to create cookies and delete cookies with JavaScript, PHP, NodeJS & Python etc.

In cookies, we have many options like Expires, Domain, Path, Secure, Name they are used when we create a cookie or read a cookie.

1.Expire: we can use it to set the date the cookie will expire.
2.Secure: a browser only use HTTP.
3.Domain: The domain name of your site.
4.Path: The path to the directory or web page that set the cookie.

How to set cookies with JS?

Alt Text

For NodeJS, you need to require HTTP in your code and directly use cookies.

If you find this useful in a post like and save this post also comments about your thoughts. For more content follow me on Instagram @developer_nikhil27.

Top comments (2)

mccurcio profile image
Matt Curcio

Yes. 'What are cookies all about?'

nikhil27b profile image
Nikhil Bobade