问题描述
我正在构建一个Chrome扩展程序,该扩展程序仅适用于我工作的公司内的人员。
扩展需要输入 - 可以通过简单的查询生成一个共享的MySQL数据库服务器(所有员工都可以通过只读权限访问)。
I am building a chrome extension which will only be available for people within the company I work for.The extension needs input - which can be generated with a simple query to a shared MySQL DB server (to which all employees can access with read only permissions).
问题是 - 因为扩展是所有客户端(主要是Javascript) - 访问数据库并运行查询最简单的方法是什么?我需要创建一个php / java(/ ...)服务来实现这个功能吗?
The question is - since the extension is all client side (mainly Javascript) - what's the simplest way to access the DB and run the query? Do I have to create a php/java(/...) service which does that for the extension?
推荐答案
必须创建一个中介Web应用程序,它将与数据库进行交互。然后,您可以从扩展程序向您的Web应用程序的API调用AJAX调用,该API将依次查询数据库并返回结果。
You'll have to create an intermediary web app that will interface with the Database. Then you can make AJAX calls from the extension to your web app's API, which will in turn query the database and return results.
Chrome扩展→Web应用程序API→MySQL
Chrome Extension → Web App API → MySQL
这篇关于从Chrome扩展程序连接到数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!