mirror of
https://github.com/typicode/json-server.git
synced 2025-07-29 21:23:41 +08:00
Allows for alternate foreign key attribute names, eg snake case (post_id). Defaults to 'Id' (#556)
This commit is contained in:

committed by
typicode

parent
02c3ea936e
commit
f1d7677d01
@ -63,6 +63,11 @@ module.exports = function () {
|
||||
description: 'Set database id property (e.g. _id)',
|
||||
default: 'id'
|
||||
},
|
||||
foreignKeySuffix: {
|
||||
alias: 'f',
|
||||
description: 'Set foreign key suffix, (e.g. _id as in post_id)',
|
||||
default: 'Id'
|
||||
},
|
||||
quiet: {
|
||||
alias: 'q',
|
||||
description: 'Suppress log messages from output'
|
||||
|
@ -42,9 +42,8 @@ function createApp (source, object, routes, middlewares, argv) {
|
||||
|
||||
try {
|
||||
router = jsonServer.router(
|
||||
is.JSON(source)
|
||||
? source
|
||||
: object
|
||||
is.JSON(source) ? source : object,
|
||||
argv
|
||||
)
|
||||
} catch (e) {
|
||||
console.log()
|
||||
|
Reference in New Issue
Block a user