Answer the question
In order to leave comments, you need to log in
Contradictions in cookie setting?
Please tell me, here I am setting a cookie on my server for the user
const express('express')
, cookieParser = require('cookie-parser'); // in order to read cookie sent from client
app.get('/', (req,res)=>{
// read cookies
console.log(req.cookies)
let options = {
maxAge: 1000 * 60 * 15, // would expire after 15 minutes
httpOnly: true, // The cookie only accessible by the web server
signed: true // Indicates if the cookie should be signed
}
// Set cookie
res.cookie('cookieName', 'cookieValue', options) // options is optional
res.send('')
})
Answer the question
In order to leave comments, you need to log in
If you set a name that already exists, then override the existing value.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question