简体   繁体   中英

Syntax Error Error When Trying to Start GraphQL Yoga Server

I'm trying to run my GraphQL Yoga server but it's complaining about a syntax error in my db.js file:

GraphQLError: Syntax Error: Cannot parse the unexpected character ".".

在此处输入图片说明

const { Prisma } = require("prisma-binding");

const db = new Prisma({
  typeDefs: './generated/prisma-client/prisma-schema.js',
  endpoint: process.env.PRISMA_ENDPOINT,
  secret: process.env.PRISMA_SECRET,
  debug: false
});

module.exports = db;

The line it doesn't like is typeDefs . When I remove the dot and just say "generated/prisma-client/prisma-schema.js" it can't parse the unexpected character "generated".

Any ideas what's going on?

Thanks

prisma generate creates a folder with the following structure

在此处输入图片说明

Inside of prisma-schema.js it exports a typeDefs property which is all graphql so in db.js you can import it like this

const typeDefs = require("./generated/prisma-client/prisma-schema").typeDefs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM