Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

demo: Develop with GraphQl on the client facing server with REST API

License

Notifications You must be signed in to change notification settings

dacz/apollo-bridge-link-example

Repository files navigation

NOT MAINTAINED ANYMORE

Use GraphQL with Rest API - demo

travis.ci Greenkeeper badge license

Develop with GraphQl on the client facing server with REST API.

This demo uses apollo-bridge-link library (build on top of Apollo).

I use the core functionality (apollo-bridge-link) for production code for clients and it works ok. But it's work in progress as the requirements arise and I implement them and then find a time to put them into this demo.

It is barebone, minimally styled.

The article about the demo is here

Run demo

# start wihh fresh data
cp db.json.dist db.json

# in one console - start JSON mock server
npm run rest-server

# in another console - start client
npm run dev

# ----
# if you want develop against GraphQL server before switching to Bridge
# (see below)
# run in another termina window:
npm run graphql-server

Develop as with GraphQL server

When you are developing on the client side (and especially with React Native), it's handy just to talk to GraphQL server with standard HTTP link and then switch to Bridge Link and keep all your work done.

This example contains demostrate, how to do this with sharing all the code (and only minor configuration of apollo link).

Basically in the App.js comment or uncomment which link you want to use.

If you choose Bridge, run only npm run rest-server.

If you choose HttpLink, run (in two opened teerminals npm run rest-server and in the second one npm run graphql-server).

Basically - your app will talk to GraphQL server (that uses all your resolvers, dataloaders etc.) and this server will talk to REST API server.

Parts

Data

Your data will be in db.json file (with your changes).

ToDo

  • demo handling authorization token
  • write blogpost about this example to explain little bit more (here)
  • graphql server for easier developing (using all logic, resolvers, etc., just switching apollo link)

Sponsors

LiveAndCode - passionate group of javascript developers (contact juraj@liveandcode.cz). Thanks!!

About

demo: Develop with GraphQl on the client facing server with REST API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published