js operates the database
js operates the database
there are feasible ways, but they all require that the database is your own, and is safe to feed the dog .
browser JavaScript cannot directly connect to the database, the most fundamental reason is that the host environment is the browser, and the browser generally does not provide TCP Socket directly to JavaScript, which is too dangerous. The closest Websocket is the application layer protocol, which the SQL server will not recognize at all. Is there any way to get TCP Socket? There is.
but all of the above methods require that your database can be accessed directly from the public network. Considering the current domestic network environment, the subject should not have his own IP, then the database will be exposed to an entire network segment, and even think about it.
I would like to add that I thought it was amazing that JackDB, was mentioned in the comments of the above subject, so I signed up for it and found that it was just a shortcut to the website. That website also works in the way that third parties forward SQL requests. It's simple and rude for to give the password directly to the website .
the front-end js certainly cannot directly manipulate the database, but you can send the data to the interface through ajax and write the data to the database through the interface.