H
H
humanIvan2018-07-10 10:03:28
Node.js
humanIvan, 2018-07-10 10:03:28

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('')

})

But what if the name that I give in cookieName is already in the cookie? Well, that is a contradiction?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-07-10
@humanIvan

If you set a name that already exists, then override the existing value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question