随笔分类 -  expressJs

query、parmas和body的区别
摘要:###query,get请求传递参数时使用,url后以url?id的形式 www.xy.com?name=LLC query就是 { name: LLC } ###parmas,url后以url/:id的形式 www.xy.com/user/33256 /:id parmas就是{ id: 3325 阅读全文

posted @ 2022-10-04 00:05 In-6026 阅读(201) 评论(0) 推荐(0)

expressJs收不到post请求体
摘要:如果是穿的json的话,加个:就可以了 app.use(express.json()) app.use(express.text()) 什么原因目前没有去纠结 如果还不行可以试试: express.raw() express.urlencoded({ extended: false }) 来自:ht 阅读全文

posted @ 2022-02-26 20:57 In-6026 阅读(125) 评论(0) 推荐(0)

(payload too large)expressJs上传文件大小受限解决方法
摘要:安装第三方模块body-parser npm i body-parser 然后在app.js中 let bodyParser = require('body-parser') app.use(bodyParser.json({ limit: '2mb' }))//此处为2MB,可改 app.use( 阅读全文

posted @ 2022-02-03 10:58 In-6026 阅读(187) 评论(0) 推荐(0)

path must be absolute or specify root to res.sendF
摘要:转载于 express版本3.0之后就将path已经分离出来了。如下改动便可正确: res.sendFile('./static/index.html'); 改成: res.sendFile(path.join(__dirname, './static', 'index.html')); 然后你可能 阅读全文

posted @ 2021-07-26 20:43 In-6026

导航