mirror of
https://github.com/typicode/json-server.git
synced 2025-08-03 04:12:22 +08:00
Refactor
This commit is contained in:
@ -32,6 +32,10 @@ var argv = yargs
|
||||
routes: {
|
||||
alias: 'r',
|
||||
description: 'Load routes file'
|
||||
},
|
||||
id: {
|
||||
description: 'Set database id property (e.g. _id)',
|
||||
default: 'id'
|
||||
}
|
||||
})
|
||||
.help('help').alias('help', 'h')
|
||||
@ -118,6 +122,10 @@ function start (object, filename) {
|
||||
}
|
||||
|
||||
server.use(router)
|
||||
|
||||
// Custom id
|
||||
router.db._.id = argv.id
|
||||
|
||||
server.listen(port, argv.host)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user