Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rune/postgraphile-callback-plugin
https://github.com/rune/postgraphile-callback-plugin
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rune/postgraphile-callback-plugin
- Owner: rune
- Created: 2019-01-22T06:18:38.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T22:19:54.000Z (about 2 years ago)
- Last Synced: 2023-12-22T07:22:16.162Z (about 1 year ago)
- Language: TypeScript
- Size: 40 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# postgraphile-callback-plugin
You can pass callback functions to this plugin, which'll then be called when specific postgraphile hooks are triggered. The ability to pass such callbacks are useful for logging and many other things.Right now, it only works for postgraphile:http:handler and postgraphile:http:end, which are called respectively when a GraphQL request is received and a result is just about to be sent back.
Use as:
```
const { postgraphile, makePluginHook } = require("postgraphile")
const { default: callbackPlugin } = require("postgraphile-callback-plugin")const graphilePluginHook = makePluginHook([
callbackPlugin
])const graphileOpt = {
pluginHook: graphilePluginHook,
startCallbackFunction: myStartCallbackFunction,
endCallbackFunction: myEndCallbackFunction}postgraphile(pool, ["mySchema"], graphileOpt)
```