Allows for alternate foreign key attribute names, eg snake case (post_id). Defaults to 'Id' (#556)

This commit is contained in:
Benjamin Bruneau
2017-06-27 14:28:34 -04:00
committed by typicode
parent 02c3ea936e
commit f1d7677d01
5 changed files with 17 additions and 9 deletions

View File

@ -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'

View File

@ -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()