mirror of
https://github.com/typicode/json-server.git
synced 2025-07-30 13:42:11 +08:00
Fix #320
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
## [0.8.17][2016-07-25]
|
||||
|
||||
* Fix snapshot creation for JS files (ex: `json-server generator.js`)
|
||||
|
||||
## [0.8.16][2016-07-11]
|
||||
|
||||
* Support `x-www-form-urlencoded`
|
||||
|
@ -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 () {
|
||||
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