Foreign key suffix (#570)

This commit is contained in:
typicode
2017-06-28 23:05:21 +02:00
committed by GitHub
parent 3ec3dec19a
commit 9bff1b6f3d
11 changed files with 169 additions and 21 deletions

View File

@ -64,7 +64,7 @@ module.exports = function () {
default: 'id'
},
foreignKeySuffix: {
alias: 'f',
alias: 'fks',
description: 'Set foreign key suffix, (e.g. _id as in post_id)',
default: 'Id'
},

View File

@ -40,10 +40,11 @@ function createApp (source, object, routes, middlewares, argv) {
let router
const { foreignKeySuffix } = argv
try {
router = jsonServer.router(
is.JSON(source) ? source : object,
argv
foreignKeySuffix ? { foreignKeySuffix } : undefined
)
} catch (e) {
console.log()