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

266
Views
having graphql server separately from nodejs server

are there any examples of using apollo graphql server (e.g. running on port 4000) alongside a nodejs server (e.g. running on some other port)? ideally i would want graphql queries to grab data from the database and then nodejs server to handle backend processing of data/user authentication

currently I have apollo graphql server running on port 4000 but am not sure how to do data processing and user authentication in the backend separately from the graphql resolvers

import express from 'express'
import { ApolloServer } from 'apollo-server-express'

import resolvers from './resolvers'
import typeDefs from './typeDefs'

import { PrismaClient } from '@prisma/client'
import cors from 'cors'
import passport from 'passport'

const prisma = new PrismaClient()

const server = new ApolloServer({
  resolvers,
  typeDefs,
  context: () => {
    return {
      prisma
    }
  }
})

const app = express();
app.use(cors());

(async function () {
  await server.start()
  server.applyMiddleware({ app })
  app.listen({ port: 4000 }, () =>
    console.log(`๐Ÿš€ Server ready at http://localhost:4000${server.graphqlPath}`)
  )
})()
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!