💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 1.读取session ~~~ const express = require("express"); const cookieParser = require('cookie-parser'); const cookieSession = require('cookie-session'); const server = express(); server.use(cookieParser()); //对session进行加密 server.use(cookieSession({ keys:['aaa','bbb','ccc'] })); server.use('/',function(req,res){ console.log(req.session["count"]); if(req.session["count"]==null){ req.session["count"]=1; }else{ req.session["count"]++; } res.send("ok") }) server.listen(8080) ~~~ ~~~ server.use(cookieSession({ //设置session的名称 name:"xxx", //设置有效期 maxAge:"" keys:['aaa','bbb','ccc'] })); ~~~