Prismic’s GraphQL API is a read-only endpoint that allows us to perform deep fetching and selective fetching for documents from your Prismic repository.
This application describes how to use Prismic’s GraphQL API with React, but you can extend this application and instructions to any other framework with a GraphQL integration.
Create new repository in prismic and generate new access token. Create new .env file using new prismic info.
Put your repo name and access token in .env.eaxmple
GATSBY_PRISMIC_REPO_NAME=YOUR_REPO_NAME
PRISMIC_ACCESS_TOKEN=YOUR_TOKEN
In this application, a notifiaction pop up and web page body are created using prismic documents.
You can use existing json formats in custom_type to create your own documents or create new one for pop up or body.
Create env for development or production
# create new env for development and production
cp .env.eaxmple .env.production
cp .env.eaxmple .env.development
Install all the packages
npm install
Navigate into your new site’s directory and start it up.
cd React-Typescript-Gatsby-Prismic/
npm run develop
Your site is now running at http://localhost:8000!
You can run grpahql query at http://localhost:8000/___graphql
🚀 Quick start (Gatsby Cloud)
Deploy this starter with one click on Gatsby Cloud: