I'm fiddling with node.js with a simple application which reads an sqlite database and tries to read the data and serialize it to objects
var fs = require("fs");
var file = "development.sqlite3";
var exists = fs.existsSync(file);
var sqlite3 = require("sqlite3").verbose();
var db = new sqlite3.Database(file);
db.serialize(function() {
var banco = db.each("SELECT id, name, genre, country FROM artists where id = 10", function(err, row) {
artist = { id: row.id, name: row.name, genre: row.genre, country: row.country };
});
});
db.close();
I'm limiting it to only one artist for debug purposes. What i'm trying to do is, with the result of this query, get, in another query, the albums informations and, for each album, it's tracks. But, as i said, i'm quite new with node.js, which is why i'm struggling with.
Aucun commentaire:
Enregistrer un commentaire