0.1.0 • Published 3 years ago

@autotelic/mercurius-postgraphile v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Mercurius PostGraphile

A Fastify plugin for integrating PostGraphile schemas with Mercurius

Contents

Usage

npm i @autotelic/mercurius-postgraphile
const mercuriusPostGraphile = require('@autotelic/mercurius-postgraphile')
const { Pool } = require('pg')
const connectionString = process.env.DATABASE_URL
const pgPool = new Pool({ connectionString })

module.exports = async function (fastify, options) {
  fastify.register(mercuriusPostGraphile, {
    connectionString,
    pgPool
  })
}

API

Options

NameStatusTypeDefaultDescription
connectionStringRequiredString-A postgreSQL database connection string, i.e. postgres://postgres:password@0.0.0.0:5432/postgres?sslmode=disable.
pgPoolRequiredObject-A client or pool instance that will be passed to the pg library and used to connect to a PostgreSQL backend.
instanceNameOptionalStringpublicA string which specifies the PostgreSQL schema that PostGraphile will use to create a GraphQL schema.
localStitchOptsOptionalObject{}An object containing local subschema config options.
postGraphileStitchOptsOptionalObject{}An object containing PostGraphile subschema config options. stitchOpts for both the local and PostGraphile schemas implement the SubschemaConfig interface. Documention can be found here
postGraphileContextOptsOptionalObject/Function{}An object or callback function containing withPostGraphileContext options, outlined here
postGraphileSchemaOptsOptionalObject{}An object containing createPostGraphileSchema options, outlined here

Example

npm i
docker-compose up -d
npm run test