How to use the lowdb.path function in lowdb

To help you get started, we’ve selected a few lowdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github typicode / json-server / src / cli.js View on Github external
function load(source, port) {
  console.log(chalk.green('\n{^ ^} Heya!\n'))

  console.log('Loading database from ' + source + '\n')

  if (/\.json$/.test(source)) {
    var path = process.cwd() + '/' + source
    low.path = path
    low.db   = require(path);
    start(port)
  }

  if (/\.js$/.test(source)) {
    var path = process.cwd() + '/' + source
    low.db   = require(path).run();
    start(port)
  }

  if (/^http/.test(source)) {
    request
      .get(source)
      .end(function(err, res) {
        if (err) {
          console.error(err)

lowdb

Tiny local JSON database for Node, Electron and the browser

MIT
Latest version published 11 months ago

Package Health Score

77 / 100
Full package analysis