xolvio / contentful-apollo-federation-example

Example of how to use the contentful-apollo-federation package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

contentful-apollo-federation example

Example repo showing how to use this package: https://github.com/xolvio/contentful-federation/

How to run

Creating the content in Contentful

This creates a "Review" content type and a "Review" content entry.

npm run build && CONTENTFUL_SPACE=<CONTENTFUL_SPACE_ID> CONTENTFUL_ACCESS_TOKEN=<CONTENTFUL_CONTENT_MANAGEMENT_TOKEN> CONTENTFUL_ENVIRONMENT=<CONTENTFUL_ENVIRONMENT> npm run create-content

Alternatively you can also create the content manually through the Contentful UI.

Installation

npm install

Building

npm run build

Starting

Starting subgraph servers

CONTENTFUL_SPACE=<SPACE> CONTENTFUL_ACCESS_TOKEN=<ACCESS_TOKEN> npm run start-subgraphs

Composing the supergraph

Requirements
npm run compose

Starting gateway server

npm run start-gateway

Creating the Contentful content manually

Creating the model in Contentful

  1. In the Contentful UI, go to the page "Content model":
  2. Add content type
  3. Name: Review
  4. Create
  5. Add field 1. Type: Text 2. Name: upc 3. Create
  6. Add field 1. Type: Text 2. Name: body 3. Long text, full-text search 4. Create
  7. Save

Creating the content in Contentful

  1. In the Contentful UI, go to the page "Content":
  2. Add entry: Review
  3. upc: 1
  4. Publish

About

Example of how to use the contentful-apollo-federation package

License:MIT License


Languages

Language:TypeScript 100.0%