Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (18 sloc) 786 Bytes
Spirit is a fast, lightweight text-driven database. Geared for prototypes, with easy replacement, and for small projects.
var spirit = require('spirit');
..Network data..e.g. get('/something/:id'), function(req, res) {
var id =;
spirit.openDatafile('something/ids.dat', 'id', id, function(data) {
//Use your data, e.g. res.render('userpage', { username: data.username });
var userDataWouldBeNice;
//same code as before, mostly
spirit.openDatafile('something/ids.dat', 'id', id, function(err, data) {
if (err) console.log(err);
userDataWouldBeNice = data;
spirit.saveDatafile('something/ids.dat', 'id', id, userDataWouldBeNice, function(err) {
if (err) console.log(err);