I'm making an app in electron and i want to use Nedb as its database.
I've tried for a couple of days to get this to work all in vain unfortunately.
I'm using electron with VueJs
any help is greatly appreciated.
Here is an example:
https://medium.com/@shivekkhurana/persist-data-in-electron-apps-using-nedb-5fa35500149a
Here is a code sample:
// create a file named main/src/db.js
const {app} = require('electron');
const Datastore = require('nedb-promises');
const dbFactory = (fileName) => Datastore.create({
filename: `${process.env.NODE_ENV === 'dev' ? '.' :
app.getAppPath('userData')}/data/${fileName}`,
timestampData: true,
autoload: true
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.