销毁Cookie NodeJs [英] Destroy cookie NodeJs
本文介绍了销毁Cookie NodeJs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 Cookie 模块设置Cookie。以下是我的代码:
I am using Cookies module for setting cookie. Here is following my code:
var options = { maxAge: ALMOST_ONE_HOUR_MS,
domain: '.test.com',
expires: new Date(Date.now() + ALMOST_ONE_HOUR_MS)
};
var value = userInfo.token;
cookies.set( "testtoken", value, options );
但在文档中我还没有找到如何销毁
But in documentation i haven't found how to destroy this cookie.
任何建议都会感激。
推荐答案
只需设置cookie作为响应:
For webapp you can just set cookie in response as :
res.cookie("key", value);
并删除cookie:
and to delete cookie :
res.clearCookie("key");
这篇关于销毁Cookie NodeJs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文