graphql-mock-object
Prototype your UI with GraphQL
mock { ... }
objects before defining complex types & resolvers.
GraphQL works best as a backend for the frontend (BFF) that matches the structure of your UI. graphql-mock-object
makes it simple for your UI to request data however you'd like. Once you're done prototyping, you can replace mocks with real resolvers and return real data.
Installation
I recommend saving into devDependencies
, as prototyping is typically done in development
, not production
.
yarn add --dev graphql-mock-object
# ...or...
npm install --save-dev graphql-mock-object
Then add it to your application:
// 👇 All the dependencies we need const schema = // The rest of your app...const app =