Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to migrate from express-graphql: loads forever #83

Closed
Zhepu-zingbox opened this issue Apr 25, 2023 · 0 comments
Closed

Unable to migrate from express-graphql: loads forever #83

Zhepu-zingbox opened this issue Apr 25, 2023 · 0 comments
Labels
question Further information is requested

Comments

@Zhepu-zingbox
Copy link

Screenshot
image
image

Expected Behaviour
Should return

{
    "data": {
        "hello": "world"
    }
}

Actual Behaviour
Check screenshot, loads forever.

Debug Information
I used 2 code snippets: one with express-graphql, the other graphql-http

const express = require("express")
const {createHandler} = require('graphql-http');
const { GraphQLSchema, GraphQLObjectType, GraphQLString } = require("graphql");

const schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'Query',
    fields: {
      hello: {
        type: GraphQLString,
        resolve: () => 'world',
      },
    },
  }),
});

const app = express()
  app.use(
  "/graphql",
  createHandler({
    schema
  })
)
app.listen(4000)
console.log("Running a GraphQL API server at http://localhost:4000/graphql")
const express = require("express")
const { graphqlHTTP } = require("express-graphql")
const { GraphQLSchema, GraphQLObjectType, GraphQLString } = require("graphql");
const schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'Query',
    fields: {
      hello: {
        type: GraphQLString,
        resolve: () => 'world',
      },
    },
  }),
});

const app = express()
app.use(
  "/graphql",
  graphqlHTTP({
    schema: schema
  })
)
app.listen(4000)
console.log("Running a GraphQL API server at http://localhost:4000/graphql")

Further Information
I'm with node v16.16.0
package.json

{
  "name": "demo",
  "version": "1.0.0",
  "description": "demo",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.2",
    "express-graphql": "^0.12.0",
    "graphql-http": "^1.18.0"
  }
}
@graphql graphql locked and limited conversation to collaborators Apr 25, 2023
@enisdenjo enisdenjo converted this issue into discussion #84 Apr 25, 2023
@enisdenjo enisdenjo added the question Further information is requested label Apr 25, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants