Skip to content

Commit

Permalink
Add initial setup for graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
eliezerbasubi committed Apr 28, 2022
1 parent 3c82329 commit 40c47aa
Show file tree
Hide file tree
Showing 8 changed files with 584 additions and 13 deletions.
Empty file added .env.sample
Empty file.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
10 changes: 10 additions & 0 deletions lib/graphql/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ApolloClient, InMemoryCache } from "@apollo/client";

const APIURL = `https://api.studio.thegraph.com/query/${process.env.NEXT_PUBLIC_SUBGRAPH_NAME}`;

const client = new ApolloClient({
uri: APIURL,
cache: new InMemoryCache(),
});

export default client;
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
};

module.exports = nextConfig
module.exports = nextConfig;
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"format": "prettier --write ."
},
"dependencies": {
"@apollo/client": "^3.6.0",
"antd": "^4.20.1",
"ethers": "^5.6.4",
"graphql": "^16.4.0",
"next": "12.1.5",
"react": "18.1.0",
"react-dom": "18.1.0"
Expand All @@ -33,12 +36,12 @@
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "npm run type-check && npm run lint"
"pre-push": "npm run type-check && next lint"
}
},
"lint-staged": {
"*.@(ts|tsx)": [
"npm run lint",
"eslint --fix",
"npm run format",
"git add ."
]
Expand Down
8 changes: 4 additions & 4 deletions pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from "next";

type Data = {
name: string
}
name: string;
};

export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: 'John Doe' })
res.status(200).json({ name: "John Doe" });
}
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
};
Loading

0 comments on commit 40c47aa

Please sign in to comment.