最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

““ post”请求不起作用,浏览器说无法读取未定义的属性'crypto'

运维笔记admin12浏览0评论

““ post”请求不起作用,浏览器说无法读取未定义的属性'crypto'

““ post”请求不起作用,浏览器说无法读取未定义的属性'crypto'

    
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.get(bodyParser.urlencoded({extended: true}));
app.get("/", function(req, res){
  res.sendFile(__dirname + "/index.html");
});
app.post("/", function(req, res){
console.log(req.body.crypto);
});
app.listen(3000, function(){
  console.log("server is running in port 3000");
});
回答如下:

您的req.body未定义,

您必须填写此行

app.get(bodyParser.urlencoded({extended: true}));

app.use(bodyParser.urlencoded({extended: true}));
发布评论

评论列表(0)

  1. 暂无评论