I have an angular/electron/ag-grid app that display information as frontend. I need to hook up the grid to access a mysql server. I was following the following link and created a mysql-service.ts:
How to use RxJS, MySQL and NodeJS
however, when I install the necessary mysql drivers by :
npm install mysql $types/mysql
the program always complain about missing references:
ERROR in ./node_modules/mysql/lib/Connection.js Module not found: Error: Can't resolve 'crypto' in 'c:\ts3\node_modules\mysql\lib' ERROR in ./node_modules/mysql/lib/protocol/Auth.js Module not found: Error: Can't resolve 'crypto' in 'c:\ts3\node_modules\mysql\lib\protocol' ERROR in ./node_modules/mysql/lib/protocol/sequences/Query.js Module not found: Error: Can't resolve 'fs' in 'c:\ts3\node_modules\mysql\lib\protocol\sequences' ERROR in ./node_modules/mysql/lib/Connection.js Module not found: Error: Can't resolve 'net' in 'c:\ts3\node_modules\mysql\lib' ERROR in ./node_modules/mysql/lib/protocol/Protocol.js Module not found: Error: Can't resolve 'stream' in 'c:\ts3\node_modules\mysql\lib\protocol' ERROR in ./node_modules/mysql/lib/protocol/Timer.js Module not found: Error: Can't resolve 'timers' in 'c:\ts3\node_modules\mysql\lib\protocol' ERROR in ./node_modules/mysql/lib/Connection.js Module not found: Error: Can't resolve 'tls' in 'c:\ts3\node_modules\mysql\lib'
I mugged around the main.js and html page to refer those reference to null or empty. However, by doing that the mysql-service
would do nothing when calling to connect to server. Please help me to connect my code to a mysql server