Before Prismic released its own GraphQL API, I started building this thing to learn GraphQL. It's unfinished, and not needed now that there's an official API.
GraphQL schema generator for Prismic
const express = require('express');
const expressGraphQL = require('express-graphql');
const prismicGraphQL = require('prismic-graphql');
const app = express();
prismicGraphQL('path/to/schemas').then(schema => {
app.use('/graphql', expressGraphQL({
schema,
graphiql: true
}));
app.listen(4000);
});
Create a GraphQL schema from a folder containing Prismic JSON schemas.
- param (String): Path to folder.
Returns a Promise containing a GraphQL schema.
git clone https://github.com/gakimball/prismic-graphql
cd prismic-graphql
npm install
npm test
MIT © Geoff Kimball