Skip to content

Commit

Permalink
WIP: Refactor to use Models, Rename Project
Browse files Browse the repository at this point in the history
Overhauling the entire project to add support for the majority of TMDB's REST API.

All entities are now managed via model classes and many resolvers for async fields are now static methods of these models. This is to help co-locate resolvers and REST response transformation, which was previously split up between resolver functions and the REST DataSource.

As a result of this refactor, there is now vastly improved typings throughout the code base.

Added support for a wide range of new data and arguments, notably cascading localization support. When a language is specified on a query or field, all nested descendants will be translated (where available) until a new language is set. This is designed to make localization of requests as simple as providing a single top-level query argument.

There are now two new top-level queries which provide powerful new ways to search for movies and tv shows, `discoverMovies` and `discoverTV`. Please take a look at the updated schema docs in the graphql playground to learn more.

All of this is currently a work in progress! Because of all the breaking changes, eventually this will be published as v3.0.0 under a new package name.
  • Loading branch information
Saeris committed Sep 8, 2020
1 parent 135fb15 commit 601bd00
Show file tree
Hide file tree
Showing 166 changed files with 6,327 additions and 2,117 deletions.
4 changes: 2 additions & 2 deletions .fiddly.config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "🎬 Mini Movie DB API",
"name": "🎬 TMDB API",
"description": "A GraphQL API wrapper for The Movie DB built with Apollo Data Sources",
"noHeader": true,
"homepage:": "http://saeris.io",
"repo": "https://github.com/saeris/mini-movie-db-api",
"repo": "https://github.com/saeris/tmdb-db-api",
"favicon": "static/favicon.ico",
"styles": "styles/styles.css"
}
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
<h1 align="center" style="display: block; text-align: center;">🎬 Mini Movie DB API</h1>
<p align="center"><a href="https://travis-ci.com/Saeris/mini-movie-db-api"><img src="https://travis-ci.com/Saeris/mini-movie-db-api.svg?branch=master" alt="Build Status" /></a><a href="https://codecov.io/gh/Saeris/mini-movie-db-api"><img src="https://codecov.io/gh/Saeris/mini-movie-db-api/branch/master/graph/badge.svg" alt="Code Coverage"/></a></p>
<h1 align="center" style="display: block; text-align: center;">🎬 TMDB API</h1>
<p align="center"><a href="https://travis-ci.com/Saeris/tmdb-api"><img src="https://travis-ci.com/Saeris/tmdb-api.svg?branch=master" alt="Build Status" /></a><a href="https://codecov.io/gh/Saeris/tmdb-api"><img src="https://codecov.io/gh/Saeris/tmdb-api/branch/master/graph/badge.svg" alt="Code Coverage"/></a></p>
<p align="center">A GraphQL API wrapper for The Movie DB built with <a href="https://www.apollographql.com/docs/apollo-server/features/data-sources.html">Apollo Data Sources</a>.</p>

> Note: v3 is currently under development, meaning these docs are subject to change!
## 🛠️ Setup

Install dependencies by running `yarn`, then create a new file in the root directory named `.env`. You'll need to get an API key from The Movie DB in order to run any queries. For more information, please read the [Movie DB docs](https://developers.themoviedb.org/3/getting-started/introduction). Additionally, if you want to track usage metrics for your API, you'll need to get an API key from Apollo Graph Manager. For instructions on how to do that, please read the [Apollo Graph Manager docs](https://www.apollographql.com/docs/graph-manager/). In your new `.env` file, copy + paste the following and replace the text following the `=` sign with your newly create API keys.

```
MOVIE_DB_API_KEY=<insert your movie database api key here>
ENGINE_API_KEY=<insert your apollo graph manager api key here>
MOVIE_DB_API_V3_KEY=<insert your movie database v3 api key here>
# OR
MOVIE_DB_API_V4_KEY=<insert your movie database v4 api key here>
APOLLO_KEY=<insert your apollo studio api key here>
```

Once that's done, you can now start up a development server using `yarn start`. By default this will use Serverless Offline, but if you would instead like to use Netlify Lamba, you can run `yarn start:netlify` instead. Once the development server is listening, you can pull up a GraphQL Playground by visiting one of the following URLs:

Lambda: http://localhost:1337/dev
Netlify: http://localhost:1337/.netlify/functions/mini-movie-db-api
Netlify: http://localhost:1337/.netlify/functions/tmdb-api

## 🕹️ Demo

You can try out the API using the GraphQL Playground hosted at https://mini-movie-db-api.saeris.io/.netlify/functions/mini-movie-db-api
You can try out the API using the GraphQL Playground hosted at https://tmdb-api.saeris.io/.netlify/functions/tmdb-api

## 🧪 Testing

Expand Down Expand Up @@ -83,4 +88,4 @@ deploy:
## 🥂 License
Released under the [MIT license](https://github.com/Saeris/mini-movie-db-api/blob/master/LICENSE.md).
Released under the [MIT license](https://github.com/Saeris/tmdb-api/blob/master/LICENSE.md).
Loading

0 comments on commit 601bd00

Please sign in to comment.