Node.js, SQLite and C++

Node.js, SQLite and C++

Problem

I am totally a beginner in Node.js and I am trying to follow tutorials and read books so I can learn more on the topic, but I had a question regarding Node.js and SQLite. I am trying to build a small website that will have a backend database. I will use Node.js to set up the website. When it comes to connecting Node.js and the database, I know there are modules (like sqlite3) that can be “imported” and used in Node.js. But I also know that SQLite can be used with the C++ library (I use C++ as a tool to start/kill Node.js files).

Would you suggest connecting the database directly with Node.js, or use it with C++? Are there any advantages for either way?

Problem courtesy of: FranXh

Solution

Most developers are using a Node.js-specific library like node-sqlite3. All sqlite libraries for Node.js that I know of use the C++ library to interact with the database, so you can probably expect to get at least as good performance using one of these well-tested Node.js libraries as you will doing it in C++ yourself.

Your best bet is to do it directly in Node.js.

Solution courtesy of: Trevor Dixon

Discussion

Leave a Reply

Your email address will not be published. Required fields are marked *