set cookie nodejs code example
Example 1: set cookie in node
res.setHeader('Set-Cookie','visited=true; Max-Age=3000; HttpOnly, Secure');
Example 2: samesite cookie nodejs
// Set a same-site cookie for first-party contexts
response.cookie('cookie1', 'value1', { sameSite: 'lax' });
// Set a cross-site cookie for third-party contexts
response.cookie('cookie2', 'value2', { sameSite: 'none', secure: true });