NEDB is a database SQLite data type, used a similar API with MongoDB, I'll use in my new project, below is a short guide on how to use it in Total.js
Using NEDB with total.js first instalale and adds it to your project with this command:
sudo npm install nedb --save
In /definitions/ creates a file called nedb.js or name you prefer and paste it
// sudo npm install nedb --save
var Datastore = require('nedb')
, db = new Datastore({ filename: '/path/file', autoload: true });
global.db = db;
Within a function of control put this to test
db.insert([{ a: 'Teste ok' }, { b: 'Teste 2 ok' }], function (err, newDocs) {
// Two documents were inserted in the database
// newDocs is an array with these documents, augmented with their _id
});
self.plain('Dados inseridos');
Run the application node index.js, go to the url and then goes in the path of the database file and see if the date is :), you can now play with NEDB, see more details here
https://github.com/louischatriot/nedb