-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
50 setup apollo client for ssr with nextjs (#51)
* build(frontend): install apollo client and simplify environment variables * fix(frontend): disable apollo caching results * feat: create example client * feat: setup graphql codegen and example usage * docs: 📝 Update docs for graphQL codegen * refactor(frontend): Make blog use graphql queries with apollo * refactor: 🗑️ Remove unused code * fix: 🚑 Fix build issues with nextjs and apollo client Fixed in the new apollo client alpha. issue tracked here apollographql/apollo-client-nextjs#113 * fix: Fix styling and linting ignore files. Also style with prettier * docs: 📝 Update docs * refactor(frontend): Refactor blog article page to use graphQL * fix: fix lint error * refactor(frontend): 🔥 remove unused console logs * fix(frontend): fix undefined attributes error * fix(frontend): 🐛 try to fix undefined attributes bug * docs: 📝 Update graphql typegen docs * fix: 🐛 disable caching while developing * fix: 🐛 fix undefined error * fix: 🐛 Fix author avatar image bug
- Loading branch information
Showing
19 changed files
with
6,760 additions
and
637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# Database API URL | ||
API_URL=http://localhost:1337/api/ | ||
HOST_URL=http://localhost:1337 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# Heroku Database API | ||
API_URL=https://small-sat-lab-6ad3da13947b.herokuapp.com/api/ | ||
HOST_URL=https://small-sat-lab-6ad3da13947b.herokuapp.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"] | ||
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"], | ||
"ignorePatterns": ["src/__generated__/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage | ||
|
||
# Ignore graphQL codegen generated types | ||
src/__generated__/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { CodegenConfig } from "@graphql-codegen/cli"; | ||
|
||
const HOST_URL = "http://localhost:1337"; | ||
|
||
const config: CodegenConfig = { | ||
schema: HOST_URL + "/graphql", | ||
// this assumes that all your source files are in a top-level `src/` directory - you might need to adjust this to your file structure | ||
documents: ["src/**/*.{ts,tsx}"], | ||
generates: { | ||
"./src/__generated__/": { | ||
preset: "client", | ||
plugins: [], | ||
presetConfig: { | ||
gqlTagName: "gql", | ||
}, | ||
}, | ||
}, | ||
ignoreNoDocuments: true, | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.