Skip to content

dsanch3z/themoviedb-graphql

Repository files navigation

Graphql The Movie DB API wrapper example.

Summary

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.

Npm Tasks

Runs development server

yarn dev

* You can also use now dev if you have now installed.

Generates typings from src/generated/schema.graphql

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

Develop

  1. Clone the project
  2. Run yarn install to install dependencies
  3. Rename env.example to .env and put your tmdb api key.
  4. Run yarn dev to start the graphql playground
  5. Open http://localhost:3000
  6. Drink a beer

About

Graphql OMDB Api wrapper example.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published