Setting up prisma graphql playground with graphql yoga

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

Read more here: Source link