mirror of
https://github.com/typicode/json-server.git
synced 2025-07-29 21:23:41 +08:00
Fix #320
This commit is contained in:
@ -134,12 +134,9 @@ module.exports = function (argv) {
|
||||
if (chunk.trim().toLowerCase() === 's') {
|
||||
var filename = 'db-' + Date.now() + '.json'
|
||||
var file = path.join(argv.snapshots, filename)
|
||||
app
|
||||
.db
|
||||
.write(file)
|
||||
.then(function () {
|
||||
console.log(' Saved snapshot to ' + path.relative(process.cwd(), file) + '\n')
|
||||
})
|
||||
var state = app.db.getState()
|
||||
fs.writeFileSync(file, JSON.stringify(state, null, 2), 'utf-8')
|
||||
console.log(' Saved snapshot to ' + path.relative(process.cwd(), file) + '\n')
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user