I'm developing a Chrome extension and I'm looking for a way to get client JavaScript, without any back-end layer on my side. Is it possible? Maybe it's possible to make an AJAX request to the Google Cloud with a SQL query as a parameter? I'm using Google OAuth. Thanks!
Asked
Active
Viewed 364 times
-1

Dmitriy Kozyatinskiy
- 170
- 11
-
Possible duplicate of [Connecting to DB from a Chrome Extension?](http://stackoverflow.com/questions/5769081/connecting-to-db-from-a-chrome-extension) – Zig Mandel May 15 '16 at 15:02
1 Answers
1
As Cloud SQL uses the MySQL wire protocol and there is no javascript support for this (or even for the underlying socket requirements) it is not possible to directly connect Javascript to Cloud SQL.
You probably shouldn't do this even if you could, as its very difficult to make a system like that secure. As you would have to embed the username/password for the database in your extension, you cannot enforce any separation of data between your users.
A backend is usually needed to enforce ACLs, and also makes future development (an app, website, desktop app, API etc) much easier. This backend does not have to be a complex beast - Firebase provides a good backend out of the box with no coding required (although it isn't backed by MySQL).

David
- 9,288
- 1
- 20
- 52