September 2018
Intermediate to advanced
328 pages
9h 10m
English
The load-assets.js file also contains a method for creating a mock database instance:
const loadDb = () => { const dbPath = path.resolve(assetsPath, 'db.json'); const adapter = new FileSync(dbPath); return low(adapter);};
The loadDb() function loads the contents of /assets/db.json into an instance of lowdb. The default function exported from load-assets.js calls the loadWasm() and loadDb() functions and returns an object containing the mock database and Wasm instance:
module.exports = async function loadAssets() { const db = loadDb(); const wasmInstance = await loadWasm(); return { db, wasmInstance };};
Going forward, I'll use the term database to refer to the lowdb instance that accesses the db.json file. Now that ...
Read now
Unlock full access