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

212
Views
No puedo averiguar por qué mi servidor no se está ejecutando
import express, { Application, Request, Response, NextFunction } from "express"; import connectToDB, { getMongoClient } from "./utils/db"; import dotenv from "dotenv"; import {ApolloServer} from 'apollo-server-express' import {typeDefs} from './schemas/todo' import UserData, {UserDocument} from './datasources/userdatasource' import {UserResolver} from './resolvers/userResolver' import { Collection } from "mongodb"; import {buildSchema} from 'type-graphql' import {customAuthChecker} from './auth/authChecker' import { validateAcessToken } from "./middleware/checkToken"; import http from 'http' dotenv.config(); const app: Application = express(); const path:string = "/graphql"; const httpServer = http.createServer(app); // let userCollection:Collection<UserDocument>; (async () => { try { await connectToDB(); console.log("Database connected Welcome") } catch (error) { console.log(error) } })(); async function startServer(){ try { const schema = await buildSchema({ resolvers:[UserResolver], dateScalarMode: "isoDate", authChecker:customAuthChecker, }) const server = new ApolloServer({schema, context: ({req, res}) => { return {req, res} } }) app.use(validateAcessToken) await server.start() server.applyMiddleware({app, path}) await new Promise<void>(resolve => httpServer.listen({ port: 4000 }, resolve)); console.log(`🚀 Server ready at http://localhost:4000${server.graphqlPath}`); } catch (error:any) { console.log(error.message) } } startServer()

Estoy escribiendo el código anterior para que mi apollo-server-express se inicie. Incluso recibo el mensaje de que mi servidor se ha iniciado en la terminal, pero cuando navego a la URL, el servidor no tiene idea de por qué este podría ser el caso. Sería útil si alguien pudiera ayudarme

about 4 years ago · Juan Pablo Isaza
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!