Prisma 1 Forum

Setting up Prisma with apollo-server-express

Hello guys i decided to migrate from graphql-yoga to apollo-server-express and this is how am doing it.

const { ApolloServer } = require('apollo-server-express')
const Mutation = require("./resolvers/Mutation");
const Query = require("./resolvers/Query");
const db = require("./db");

function createServer() {
  return new ApolloServer({
    typeDefs: './src/schema.graphql',
    resolvers: {
    context: req => ({ ...req, db })

module.exports = createServer;`

Previously this is how i imported types from generated prisma schema #import * from './generated/prisma.graphql' but its not working in apollo-server-express. Instead i get this error Invalid or unexpected token. What is the fix to this

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.