Graphql The Movie DB API wrapper example.
This project shows how to wrap a rest API to use it as a GraphQL endpoint. This may be not the perfect implementation, but I did it the simplier I could.
Each ThMDB endpoint (examples: /search, /discover) is in its own folder (rest-datasources/
) to avoid having one single big ass class (see apollo-datasource-rest).
The project uses Apollo Server, Typescript, Babel, graphql-cli, etc.
yarn dev
* You can also use now dev
if you have now installed.
It generates the necesary bindings for Typescript in a .ts
file as described in .graphqlconfig.yaml
.
It is meant to be ran only after running gql:prepare
yarn gql:codegen
Fetches the remote schema from a server into src/generated/schema.graphql
using the graphql-cli
In this case the dev server. The downside is that you have to run the dev server first and then run this task in another terminal tab.
yarn gql:get-schema
- Clone the project
- Run
yarn install
to install dependencies - Rename
env.example
to.env
and put your tmdb api key. - Run
yarn dev
to start the graphql playground - Open http://localhost:3000
- Drink a beer