随笔 - 45,  文章 - 0,  评论 - 2,  阅读 - 30144

随笔分类 -  nodejs

eggjs 跨域配置
摘要:1. 修改配置文件 // config.default.js config.session = { ... sameSite: "none", secure: true, }; config.cors = { origin: "xxx", credentials: true, allowMethod 阅读全文
posted @ 2024-08-07 00:12 W1N9s 阅读(18) 评论(0) 推荐(0) 编辑
eggjs 配置 middleware
摘要:1. 方式一:在路由里配置 - router.js module.exports = (app) => { const { router, controller, io } = app; const userAuth = app.middleware.userauth(app); router.ge 阅读全文
posted @ 2021-06-14 16:57 W1N9s 阅读(345) 评论(0) 推荐(0) 编辑
nodejs 获取文件路径
摘要:1. 获取当前工作进程的目录:process.cwd() 2. 当前模块的目录名:__dirname;或者 path.dirname(path) 3. 当前模块的文件名:__filename 阅读全文
posted @ 2021-01-31 11:36 W1N9s 阅读(630) 评论(0) 推荐(0) 编辑
eggjs 获取 session 失败
摘要:本地开发时,登录成功时设置了 session,但是再次发起请求时获取 session 为空。 解决方法 : 原因是前端请求地址设置的是 127.0.0.1:3000。 请求地址改为:localhost:3000 就可以正常获取了。 以前运行一直好好的,突然就不行了,不知道什么原因。 阅读全文
posted @ 2020-12-22 16:05 W1N9s 阅读(578) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示