rsnext/examples/with-reason-relay/README.md
Flavian Desverne f9cb5ac6b0
Replace Graphcool with dedicated example GraphQL server using Prisma (#15752)
## Motivation

As Graphcool is being shutdown, we replaced all the graphcool api endpoints with some handcrafted APIs using Prisma & Nexus, that can be found here https://github.com/prisma-labs/nextjs-graphql-api-examples. These GraphQL endpoints are now deployed to Vercel.

## Notes

- I couldn't get the reason-relay example to run. Given that the relay endpoint works on the other relay example, I don't see any reason why it wouldn't work on that one
- The `with-apollo` example is buggy when creating some posts, but nothing related to the switch of the api endpoint as it was already buggy before. I suspect the `concatPagination` strategy to be the cause of that bug, but I couldn't figure it out.

Fixes #14780
2020-08-05 06:26:54 +00:00

74 lines
1.7 KiB
Markdown

# Reason Relay Example
[Reason Relay](https://reason-relay-documentation.zth.now.sh/)
This example relies on [Prisma + Nexus](https://github.com/prisma-labs/nextjs-graphql-api-examples) for its GraphQL backend.
## Deploy your own
Deploy the example using [Vercel](https://vercel.com):
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/with-reason-relay)
## How to use
### Using `create-next-app`
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
```bash
npx create-next-app --example with-reason-relay with-reason-relay
# or
yarn create next-app --example with-reason-relay with-reason-relay
```
### Download manually
Download the example:
```bash
curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-reason-relay
cd with-reason-relay
```
Install it:
```bash
npm install
# or
yarn
```
Download schema introspection data from configured Relay endpoint
```bash
npm run schema
# or
yarn schema
```
Run Relay ahead-of-time compilation (should be re-run after any edits to components that query data with Relay)
```bash
npm run relay
# or
yarn relay
```
Build the project
```bash
npm run build
# or
yarn build
```
Run the project
```bash
npm run dev
# or
yarn dev
```
Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).