test graphql uri fix
All checks were successful
Main / build-and-push-docker-image (20.x) (push) Successful in 6m1s
All checks were successful
Main / build-and-push-docker-image (20.x) (push) Successful in 6m1s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
import { createYoga, Plugin, createSchema } from "graphql-yoga";
|
||||
import { EnvelopArmor } from "@escape.tech/graphql-armor";
|
||||
import { EnvelopArmorPlugin } from "@escape.tech/graphql-armor";
|
||||
import resolvers from "@/graphql/resolvers";
|
||||
import typeDefs from "@/graphql/types";
|
||||
|
||||
@@ -48,9 +48,6 @@ function useApiKey(): Plugin {
|
||||
};
|
||||
}
|
||||
|
||||
const armor = new EnvelopArmor();
|
||||
const protection = armor.protect();
|
||||
|
||||
const { handleRequest } = createYoga<NextContext>({
|
||||
schema: createSchema({
|
||||
typeDefs: typeDefs,
|
||||
@@ -58,15 +55,12 @@ const { handleRequest } = createYoga<NextContext>({
|
||||
}),
|
||||
|
||||
// While using Next.js file convention for routing, we need to configure Yoga to use the correct endpoint
|
||||
graphqlEndpoint:
|
||||
process.env.NEXT_PUBLIC_GRAPHQL_URL ||
|
||||
process.env.GRAPHQL_UR ||
|
||||
"/api/graphql",
|
||||
graphqlEndpoint: "/api/graphql",
|
||||
|
||||
// Yoga needs to know how to create a valid Next response
|
||||
fetchAPI: { Response },
|
||||
|
||||
plugins: [...protection.plugins, useApiKey()],
|
||||
plugins: [useApiKey(), EnvelopArmorPlugin()],
|
||||
graphiql: environment !== "production" ? true : false
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user