GithubHelp home page GithubHelp logo

subscriptions-prisma-apolloclient-demo-1's Introduction

server setup

cd server
yarn
yarn global add prisma
prisma init

// now select 'demo server', register with Prisma Cloud (where demo server is hosted), accept all default values. select prisma javascript client (if you have to) prisma deploy

this should have setup a free and hosted demo db (AWS Aurora) available in Prisma Cloud. Read to now use Prisma client to read and writ to it from code

copy the endpoint of your prisma server to endpoint field in server/prisma/prisma.yml, if you need to. the uri comes from terminal info after running 'prisma deploy'

client setup

from root of project cd into 'client' folder
yarn

start server and client

  1. in one terminal tab navigate to 'server' folder, then yarn start
  2. then in another terminal navigate to 'client' folder, the run yarn start

subscription output

goto localhost:3000 (or whereever the react client app is running) and checkout the console output in developer tools

in another browser tab goto the graphql playground localhost:4000 (or wherever your server is running). make a mutation and see that the client app gets the results via its subscription outputted in its console in browser tab.

an example mutation:

mutation {
  createDraft(title: "yyyyy", content: "hello hellooooooooo") {
    id
    createdAt
    published
    title
    content
  }
}

subscriptions-prisma-apolloclient-demo-1's People

Contributors

doctorcobweb avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.