How to use the parse function from cookie

Find comprehensive JavaScript cookie.parse code examples handpicked from public code repositorys.

23
24
25
26
27
28
29
30
31
32
if (!socket.request.headers.cookie) {
	next(new Error("No cookie transmitted."));
	return;
}

let cookies = cookie.parse(socket.request.headers.cookie);

if (!cookies.sid) {
	next(new Error("No sid transmitted."));
	return;
fork icon0
star icon0
watch icon1

54
55
56
57
58
59
60
61
62
63
// no cookies
if (!cookies) {
  return next()
}

req.cookies = cookie.parse(cookies, options)

// parse signed cookies
if (secrets.length !== 0) {
  req.signedCookies = signedCookies(req.cookies, secrets)
fork icon0
star icon0
watch icon0