+ 1

What is the best way to import a sql file into a js file by node and how to use sql file query in the js file

10th Jun 2020, 9:17 PM
Arsham Aazami
Arsham Aazami - avatar
2 odpowiedzi
+ 1
I'm assuming this question has been covered in previous questions, i recommend you use the search feature and look at some of those. If you want to open a .sql file use "fs" library to open it and use "sqlite3" library to query it, you can see an example here https://gist.github.com/TheoOkafor/1762e455b0e76c6764f0deabc08c8a77#file-index-js More commonly youll be working with live databases in which case it depends on the exact database you want to query, ex. MySQL you would the "mysql" library. https://www.w3schools.com/nodejs/nodejs_mysql.asp
10th Jun 2020, 9:43 PM
JME
+ 1
Go to https://glitch.com sign up an account, you can setup and use a node.js code with sqlite right from the startup template.
12th Jun 2020, 2:24 AM
Calviղ
Calviղ - avatar