【问题标题】:What should be the endpoint address when I use Flutter + Deno?当我使用 Flutter + Deno 时,端点地址应该是什么?
【发布时间】:2021-12-13 01:10:54
【问题描述】:

我在 Windows 10 中使用 Flutter、VSCode 和 Android 模拟器。还将 Deno 作为后端服务器。我正在尝试在我的 PC 中本地将 Flutter 应用程序连接到 Deno 应用程序。但我不知道我必须使用哪个地址?

这是我尝试从 Flutter 应用发送 get, post, etc. 请求的地址:

http://10.0.2.2:8000/api/register

这是我试图在我的 deno 应用程序中接收这些请求的地址:

Listening on: http://0.0.0.0:8000

当我使用邮递员使用以下地址对其进行测试时,/api/register 等端点可以工作:

0.0.0.0:8000/api/register

我不知道是什么问题,我该如何解决?

【问题讨论】:

  • 如何更新您的 Flutter 应用以调用 0.0.0.0:8000/api/register 而不是 10.0.2.2:8000/api/register?
  • 与@mfulton26 的评论类似:您可能想尝试http://localhost:8000/api/register 作为地址
  • @mfulton26:这样做我得到了这个错误socketexception os error connection refused errno = 111 address = 0.0.0.0.port=33668

标签: flutter android-emulator crud endpoint deno


【解决方案1】:

看来我在使用Android Emulator的时候想指出http://localhost必须使用下面的地址:

http://10.0.2.2

这意味着 Android 模拟器中的 localhost。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-29
    • 1970-01-01
    相关资源
    最近更新 更多