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}`)
)
})()