Answer the question
In order to leave comments, you need to log in
Node js + express how to set cookies via function?
There is a server on Node js with express,
I have a code by which I calmly set cookies for the user
app.use('/',function(req, res, next){
res.cookie('userid', '', { expires: new Date(Date.now() + 900000), httpOnly: true });
});
function authclients(){
app.use('/',function(req, res, next){
res.cookie('userid', '', { expires: new Date(Date.now() + 900000), httpOnly: true });
});
}
Answer the question
In order to leave comments, you need to log in
app.use('/', authclients(req, res) );
function authclients(req, res) {
res.cookie('userid', '', { expires: new Date(Date.now() + 900000), httpOnly: true });
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question