How node req.session writes data to cookie

for example, the
backend code is as follows:

self.req.session.user= userId;

data in browser

clipboard.png
how do you do that? Which strings and times are assigned values?

Mar.01,2021

https://github.com/expressjs/. can take a look here


response with set-cookie header


The

client (browser) sends a http request to the server, and the server replies a http response to the client. This response contains some important header fields, including the Set-Cookie field. As the name implies, this field tells the browser to update the cookie of the corresponding site according to the content in the Set-Cookie field of the response. So the browser obediently sets cookie to what you see as the server says. For more information, search for the keywords "http request" and "http response", or "http header field"

in addition, session and cookie are two different things, except that session needs to be marked with cookie .

Menu