Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
no puedo recuperar el servidor graphql

hola, seguí un tutorial para GraphQL, ese es el código que escribí hasta ahora:

 const express = require('express'); const {graphqlHTTP} = require('express-graphql'); const graphql = require('graphql') const { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLList, } = graphql; const users = require('./users.json') const app = express(); const userType = new GraphQLObjectType({ name:'User', fields: () => ({ email: { type: GraphQLString}, username: { type: GraphQLString}, name: { type: GraphQLString}, company: { type: GraphQLString}, address: { type: GraphQLString}, }) }) const RootQuery = new GraphQLObjectType({ name:'RootQueryType', fields: () => ({ getAllUsers: { type: new GraphQLList(userType), resolve(parent,args){ return users } } }) }) const Mutation = new GraphQLObjectType({ name:"mutation", fields: () => ({ createUser: { type: userType, args:{ email: { type: GraphQLString}, username: { type: GraphQLString}, name: { type: GraphQLString}, company: { type: GraphQLString}, address: { type: GraphQLString}, }, resolve(parent,args){ users.push({ email: args.email, username: args.usename, name: args.name, company: args.company, adress: args,company, }) return args } } }) }) const schema = new GraphQLSchema({query: RootQuery, mutation: Mutation}) app.use('/graphql', graphqlHTTP({ schema:schema, graphql:true })) app.listen(5000, ()=>{ console.log('server started') })

pero cuando llegué a localhost: 5000/graphql en el navegador obtengo: {"errores": [{"mensaje": "Debe proporcionar una cadena de consulta".}]} Traté de verificar que graphqlstring se haya importado correctamente y todo está bien. He buscado mucho, espero que la respuesta esté aquí.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

¿Puedes reemplazar graphql: true, por graphiql: true, ? según here También, en general, intente tener el puerto como 4000

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!