Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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