mirror of
https://github.com/typicode/json-server.git
synced 2025-07-30 13:42:11 +08:00
test: should update json file
This commit is contained in:
@ -24,7 +24,7 @@ module.exports = function (source) {
|
||||
var db
|
||||
if (_.isObject(source)) {
|
||||
db = low()
|
||||
db.state(source)
|
||||
db.setState(source)
|
||||
} else {
|
||||
db = low(source, { storage: fileAsync })
|
||||
}
|
||||
@ -45,7 +45,7 @@ module.exports = function (source) {
|
||||
|
||||
// GET /db
|
||||
function showDatabase (req, res, next) {
|
||||
res.locals.data = db.state()
|
||||
res.locals.data = db.getState()
|
||||
next()
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ module.exports = function (db, name) {
|
||||
var resource = db.get(name).removeById(utils.toNative(req.params.id)).value()
|
||||
|
||||
// Remove dependents documents
|
||||
var removable = db._.getRemovable(db.state())
|
||||
var removable = db._.getRemovable(db.getState())
|
||||
|
||||
_.each(removable, function (item) {
|
||||
db.get(item.name).removeById(item.id).value()
|
||||
|
Reference in New Issue
Block a user