node.js - http POST 上的 net::ERR_SSL_PROTOCOL_ERROR 到快递服务器
问题描述
我正在尝试从反应客户端发布到本地主机上的快速服务器,我在谷歌浏览器中收到此错误。
反应应用程序:http://localhost:3000 快速应用程序:http://localhost:5000
POST https://localhost:5000/upload net::ERR_SSL_PROTOCOL_ERROR
我没有任何 SSL https 自签名证书,但我需要吗?我已经在我的 express 应用程序的一个目录中使用 create-react-app 来引导我的前端,所以我不知道某处的 webpack 设置是否试图将 http 作为 https 处理这个特定操作?
我没有为我的 express js 应用程序使用任何引导程序,我将在下面包含我的服务器文件以供参考。
const express = require ('express')
const bodyParser = require ('body-parser')
const port = 5000
var app = express()
var cors = require("cors");
app.use(cors())
app.use(bodyParser())
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
app.post('/upload', (req,res)=>{
if (req.files === null ){
return res.status(400).json({message: 'no image uploaded please try again'})
}else{
const file = req.files.file
let body = req.body
res.json({body})
}
})
我知道关于这个问题有很多问题,但它们不相关或没有为我提供任何见解。我已经尝试确保端口也允许通过我的防火墙。我还清除了我的浏览器缓存。
解决方案
推荐阅读
- r - Yahoo Finance Screener - 使用 R 进行网页抓取
- jpa - 一对多 vs 在一条记录中存储 id
- javascript - Square Refund cURL to JavaScript Request Not Found.. Google 应用脚本
- python - 如何创建一个不断将元素添加到列表中直到它们等于某个变量的函数?
- vba - 直通不再返回十进制值
- flutter - 按下“添加产品”时,在同一页面上添加更多产品容器
- vba - 使用 Listbox 和 RecordsetClone 属性导航记录
- security - Owasp zap 工具 - 如何获取通过和失败测试的列表?
- python - 弄清楚 datetime 模块的用法
- android - 在 andriod studio 4.0 中启用/禁用离线模式