@brooklyn-labs/postgraphile-plugin-apollo-federation
TypeScript icon, indicating that this package has built-in type declarations

0.4.4 • Public • Published

postgraphile-plugin-apollo-federation

GitHub Workflow Status (with branch) npm (scoped) License

Apollo federation support for PostGraphile (or any Graphile Engine schema).

Installation

npm install postgraphile-plugin-apollo-federation

CLI usage

postgraphile --append-plugins postgraphile-plugin-apollo-federation

Library usage

const express = require("express");
const { postgraphile } = require("postgraphile");
const { default: postgraphile-plugin-apollo-federation } = require("postgraphile-plugin-apollo-federation");

const app = express();

app.use(
  postgraphile(process.env.DATABASE_URL, "public", {
    appendPlugins: [postgraphile-plugin-apollo-federation],
  })
);

app.listen(process.env.PORT || 3000);

How?

This plugin exposes the Global Object Identification Specification (i.e. Node interface) in a way that's compatible with Apollo Federation.

Requires PostGraphile v4.4.2-rc.0+

Testing

Docker can be used to spin up a test instance for running Jest tests. The instance will be exposed at port 5432. See .env.example for the exported Postgre connection.

docker compose up -d
./scripts/test

Do you need this?

Only use this if you're planning to have your API consumed by Apollo Federation; exposing these redundant interfaces to regular users may be confusing.

Status

Proof of concept. No tests, use at your own risk! Pull requests very welcome.

Package Sidebar

Install

npm i @brooklyn-labs/postgraphile-plugin-apollo-federation

Weekly Downloads

16

Version

0.4.4

License

MIT

Unpacked Size

40.5 kB

Total Files

15

Last publish

Collaborators

  • jkbjnsn
  • andrisak
  • johnciprian