How to use the lowdb.mixin 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 / router.js View on Github external
var express = require('express')
var methodOverride = require('method-override')
var bodyParser = require('body-parser')
var _ = require('underscore')
var low = require('lowdb')
var utils = require('./utils')

low.mixin(require('underscore-db'))
low.mixin(require('underscore.inflections'))
low.mixin({ createId: utils.createId })

module.exports = function(source) {
  // Create router
  var router = express.Router()

  // Add middlewares
  router.use(bodyParser.json({limit: '10mb'}))
  router.use(bodyParser.urlencoded({ extended: false }))
  router.use(methodOverride())

  // Create database
  if (_.isObject(source)) {
    var db = low()
    db.object = source

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