ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ const express = require("express"); const bodyParser = require('body-parser'); const multer = require('multer'); const cookieParser = require("cookie-parser"); const cookieSession = require('cookie-session'); const server = express(); server.listen(8080); var arr=[]; for(var i=0;i<1000;i++){ arr.push("keys"+Math.random()) } /* 1.解析cookie */ server.use(cookieParser("qwert")); /* 2.使用session */ server.use(cookieSession({name:"zen_id",keys:arr})) /* 3.post数据 */ server.use(bodyParser.urlencoded({extended:false})); server.use(multer({dest:"./www/assets/"}).any()); /* 4.用户请求 */ server.use(function(req,res){ console.log(req.query,req.body,req.files,req.cookies,req.session) }) /* static数据 */ server.use(express.static("./www")) ~~~