mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-14 15:11:24 +00:00
14 lines
489 B
JavaScript
14 lines
489 B
JavaScript
var Datastore = require('nedb');
|
|
var path = require('path');
|
|
|
|
// 数据库初始化
|
|
// var dbPath = require('nw.gui').App.dataPath + '/nedb'
|
|
var dbPath = '/Users/life/Library/Application Support/Leanote' + '/nedb';
|
|
var db = {};
|
|
var dbNames = ['notebooks', 'notes', 'users', 'tags', 'images', 'attachs'];
|
|
for(var i in dbNames) {
|
|
var name = dbNames[i];
|
|
db[name] = new Datastore({ filename: path.join(dbPath, name + '.db'), autoload: true });
|
|
}
|
|
module.exports = db;
|
|
console.log('db init'); |