Files
bodyshop/server/graphql-client/graphql-client.js
2020-05-21 16:38:06 -07:00

18 lines
526 B
JavaScript

const GraphQLClient = require("graphql-request").GraphQLClient;
const path = require("path");
require("dotenv").config({
path: path.resolve(
process.cwd(),
`.env.${process.env.NODE_ENV || "development"}`
),
});
//TODO May need to use a different client that includes caching of resources.
exports.client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
headers: {
"x-hasura-admin-secret": process.env.HASURA_ADMIN_SECRET,
},
});
exports.unauthclient = new GraphQLClient(process.env.GRAPHQL_ENDPOINT);