How to define the port of my graphql-yoga server, in Nextjs

11 views Asked by At

How would you define your graphql server port, using graphql-yoga and nextjs with legacy (pages) structure?

here's my current code:

import { createSchema, createYoga } from "graphql-yoga";
import typeDefs from "../../gql/schema";
import resolvers from "../../gql/resolvers";

const schema = createSchema({
  typeDefs,
  resolvers,
});

const server = createYoga({
  graphqlEndpoint: "/api/graphql",
  schema,
  graphiql: false,
  cors: {
    origin: dev ? process.env.API_DEV_DOMAIN : process.env.API_PROD_DOMAIN,
    credentials: true,
    allowedHeaders: ["X-Custom-Header"],
    methods: ["POST"],
  },
});

export default server;
0

There are 0 answers