Skip to content

Latest commit

 

History

History
71 lines (49 loc) · 2.5 KB

README.md

File metadata and controls

71 lines (49 loc) · 2.5 KB

🍸 demo-apollo-server

Live demo - Slides - Apollo-client part

This demo app creates a MongoDB collection, exposes it via a GraphQL endpoint, and also creates corresponding REST endpoints.

How to use

HTTP headers

You will need to authenticate yourself by filling GraphQL Playground's HTTP headers:

{
  "device_id": "test"
}

Running with distant database

yarn
USE_DISTANT_DB=true DB_USER=demo-apollo-server DB_PASSWORD=apollo yarn start
open http://localhost:3000/graphql

Connect to this local URL for a pre-filled query.

Note: You must identicate yourself with a device_id (passed via headers). E.g.

{
  "device_id": "Test"
}

Running with local database

You need to install mongodb on your machine first.

yarn
mongod
yarn start
open http://localhost:3000/graphql

Connect to this local URL for a pre-filled query.

Note: You must identicate yourself with a device_id (passed via headers). E.g.

{
  "device_id": "Test"
}

REST

OpenAPI documentation

  • GET /api/cocktails
  • GET /api/liked-cocktails
  • GET /api/bookmarked-cocktails
  • GET /api/cocktail/:id
  • POST /api/toggle-like-cocktail?id=xxx
  • POST /api/toggle-bookmark-cocktail?id=xxx

Misc

Thanks to TheCocktailDB for the data!