How to change port on Grapql Yoga and BunJS

How to change port on Grapql Yoga and BunJS


0

I have a very simple question that I can’t find the answer to anywhere on the internet.

I’m using the Graphql Yoga framework together with the bun runtime.
On their website there is the following example:

import { createSchema, createYoga } from 'graphql-yoga'
 
const yoga = createYoga({
  schema: createSchema({
    typeDefs: /* GraphQL */ `
      type Query {
        greetings: String
      }
    `,
    resolvers: {
      Query: {
        greetings: () => 'Hello from Yoga in a Bun app!'
      }
    }
  })
})
const server = Bun.serve(yoga)
console.info(
  `Server is running on ${new URL(
    yoga.graphqlEndpoint,
    `https://${server.hostname}:${server.port}`
  )}`
)

But it always starts the server on port 3000… I’ve tried all sorts of ways to change it but I’ve never succeeded. Does anyone have any idea how to do this?


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *