1 Star 0 Fork 2

xiaoli-10086/AA

forked from huanxixi/note 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
express.md 501 Bytes
一键复制 编辑 原始数据 按行查看 历史
huanjoyjoy 提交于 2023-02-07 17:54 . 前端笔记

express

  • params参数和query参数,params参数用name编写传参,query参数用path编写传参
  • req.query() 可以接收params和query参数
  • req.body() 可接受data

获取数据的方法

get请求(获取url上面的参数)

  • req.query

post请求(获取请求体的参数)

  • 首先安装npm install body-parser --save-dev

  • const bodyParser = require('body-parser')

    app.use(bodyParser.urlencoded({ extended: false })) app.use(bodyParser.json())

  • 然后使用 req.body

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiaoli-10086/note.git
git@gitee.com:xiaoli-10086/note.git
xiaoli-10086
note
AA
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891