Why is there a difference between using lowdb directly:
// app.js
const low = require('lowdb');
const storage = require('lowdb/file-async');
const db = low('db.json', { storage });
and wrap it as module
// lib/db.js
const low = require('lowdb');
const storage = require('lowdb/file-async');
const db = low('db.json', { storage });
module.exports = db;
// app.js
var db = require('lib/db');
In second case, following code in app.js:
db1('posts')
.push({})
.then(post => res.send(post));
Produces error "then is not a function". But using lowjs directly works just fine.
