使用没有API层的离子框架连接到MySQL

发布于 2025-02-10 09:27:57 字数 206 浏览 2 评论 0原文

是否可以直接连接到没有集成/API层的离子应用程序直接连接到MySQL数据库

我在网上找到的所有答案都建议在PHP或NODEJS中创建API,但是我想开发一个SQL客户端,并且应用程序的全部要点是能够直接从客户端设备中进行查询。

我不能从客户端使用节点mysql库。

我正在使用离子6反应。

Is it possible to connect to a MySQL database directly from an Ionic application without an integration/api layer?

All the answers I found online suggest to create API in php or nodejs, but I would like to develop a sql client and the whole point of the application is to be able to make queries directly from the client device.

I cannot use the node mysql library from client side.

I am using Ionic 6 React.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟沫凡尘 2025-02-17 09:27:57

不,正如Mostafa Harb所指出的那样,您无法直接从设备中访问云中的MySQL数据库。您需要使用某种API。

基本流量:

  • 离子应用在必要时对API进行身份验证。
  • 离子应用使用Axios或获取使用API​​查询云数据库。
  • API以Ionic App了解的格式返回响应。

关于离子的好处是它主要是框架 - 敏捷,因此您可以使用自己喜欢的任何API。

就个人而言,我使用 drupal ,这是一个基于PHP ,JSON:API或GraphQl(或三个混合)。

No, as noted by Mostafa Harb, you cannot directly access a MySQL database in the cloud from a device. You'll need to use some kind of API.

The basic flow:

  • Ionic app authenticates to the API if necessary.
  • Ionic app uses Axios or Fetch to use the API to query the cloud database.
  • The API returns the response in a format the Ionic app understands.

The good thing about Ionic is that it is mostly framework-agnostic, so you can use any API you like.

Personally, I use Drupal, which is a PHP-based CMS that has support for providing access to Ionic via REST, JSON:API, or GraphQL (or a mix of the three).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文