2

In earlier prisma versions, it exposed localhost:4466 as a endpoint where graphql-playground can be accessed.

Through this playground, we could directly right queries to manipulate data in database.

I am trying to setup prisma with graphql-yoga and I am having problems.

Graphql Yoga runs on localhost:4000. Where prisma playground runs? How can I access it?

There is prisma studio which is UI for manipulating database but I need graphql interface, as it is required in node binding.

prisma.js

import { Prisma } from 'prisma-biding';

const prisma = new Prisma({
  typeDefs: 'src/generated/prisma.graphql',
  endpoint: 'localhost:5555' // here
})

index.js

import { GraphQLServer, PubSub } from 'graphql-yoga';
import db from './db';
import Query from './resolvers/Query';
import Mutation from './resolvers/Mutation';
import User from './resolvers/User';
import Post from './resolvers/Post';  
import Comment from './resolvers/Comment';
import Subscription from './resolvers/Subscription';


const pubsub = new PubSub() 
// Resolvers
const resolvers = {
  Query,
  Mutation,
  User,
  Post,
  Comment,
  Subscription
};

const server = new GraphQLServer({
  typeDefs: './src/schema.graphql',
  resolvers,
  context: {
    db,
    pubsub
  }
})

server.start(() => console.log(`Grapqhl server is running on ${process.env.port}`));
confusedWarrior
  • 938
  • 2
  • 14
  • 30
  • Perhaps you're mistaking Prisma 1 with Prisma 2? Prisma 1 had a custom server with it's own playground that you could use to run queries. Prisma 2 has a more conventional approach with a NodeJS client that you can run directly on your _own_ server. Prisma 2 does not expose a GraphQL crud API. – Tasin Ishmam Nov 26 '21 at 06:45
  • Can you answer? how can i setup? – confusedWarrior Nov 26 '21 at 06:45
  • 1
    What I'm trying to say is, I think the latest version of Prisma doesn't _have_ what you're looking for. I'm not sure using yoga and Prisma 1 are good choices right now, neither is actively developed any more. – Tasin Ishmam Nov 26 '21 at 06:47

0 Answers0