@frontierjs/api
v0.0.22
Published
API modules for FrontierJS
Downloads
86
Readme
Usage
// in api/src/core/frontier.js
// Make sure to place this in app.js AFTER app.configure(configuration)
// to get access to all the config vars
import Preload from '@frontierjs/api/preload'
import Db from '@frontierjs/api/db'
import Fetch from '@frontierjs/api/fetch'
import Logger from '@frontierjs/api/logger'
import { prismaHooks } from '../core/prisma.hooks'
export default function (app) {
[
Preload(),
Db({
...app.get('dbConfig'),
prismaHooks
}),
Fetch(),
Logger({
dbLogFile: app.get('dbLogFile') || '.api.db.log'
}),
].forEach((config) => app.configure(config))
}
// in api/src/core/prisma.hooks.js
import {
castNumbers,
removeRelations,
removeExtra,
stringifyModelFields,
parseModelFields,
setUpdatedAt
} from '@frontierjs/api/prisma-hooks'