Example of using existing sqlite3 database inside atom shell?


#1

Is there an example of using an existing sqlite3 database inside atom shell?

For instance, I want to distribute an existing sqlite3 database file with my atom shell application. Ideally, I would want to access the database from the running node instance while providing data via a rest-like api. Client-side javascript from an html file should be able to call the api and receive json data. Alternatively, I’m open to the full client-side way too if the aforementioned scenario doesn’t work.

Client-side d3.js json <- client-side (sql.js?) <- mydatabase.sqlite3 file
or
Client-side d3.js json <- server-side node (node-sqlite3 module?) <- mydatabase.sqlite3 file

Incidentally, I could not get both scenarios to work via node-webkit. Though I could’ve just missed something. So far, on the atom-shell side, I’ve gotten sqlite3 to compile via:

npm install sqlite3 --build-from-source --target_arch=x64 --target=0.11.13

Though I don’t know where the node_modules directory should go. Also, I’m not sure how to do the rest API inside the main.js file. Should I try adding Express? I’d rather keep the complexity down.

In any case, for those reasons I’m really looking for an existing example which has everything laid out already. Or, if there isn’t one out there, if anyone has any pointers, or can tell me if this is even possible?

Thanks