Skip to content

adrienharnay/demo-apollo-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍸 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!

Releases

No releases published

Packages

No packages published