网络错误(React-Native,Express,Nodejs,MongoDB) [英] Network Error (React-Native, Express,Nodejs,MongoDB)

查看:59
本文介绍了网络错误(React-Native,Express,Nodejs,MongoDB)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

调用服务器(nodejs)API时出现网络错误.

I am getting a Network Error while calling my server(nodejs) API.

我已经重新检查了我的本地主机,服务器和端口.他们都工作正常.我还确认了使用POSTMAN,并且还在本地的Web上运行了服务器以获取数据.

I have rechecked my localhost, server, and port. They are all working fine. I have also confirmed using POSTMAN and also ran the server on the web locally to fetch data.

我想我也已经在server.js文件中正确添加了cors.

I think I have also added the cors properly in my server.js file.

想要一些帮助.

我也尝试使用虚拟API,并且效果很好.

I have also tried with dummy API and they worked fine.

我从前端导入

这是LogCat

邮递员中的响应标题

ngrok状态

推荐答案

我认为您可以尝试使用ngrok之类的服务将本地主机公开到互联网,然后再为您生成一个url.发送请求,而不是localhost:3000.只需下载并按照此处的说明进行操作: https://ngrok.com/docs

Hi I think you can try exposing your local host to the internet using a service like ngrok which will generate a url for you, and then try using the url to send requests instead of localhost:3000. Simply download and follow the instructions here: https://ngrok.com/docs

这篇关于网络错误(React-Native,Express,Nodejs,MongoDB)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆