Production-ready (ish!!) GraphQL API implementation backed by oversmash.
Query player information, achievements and stats for the Overwatch game. Includes auto-generated, complete type information for all available stats (e.g "what's the average healing as Ana for this player, in competitive mode")
Features:
- Full static schema available, which when used with a compatible tool gives you full type information and suggestions (e.g in GraphiQL)
- Configurable rate limiting support
- Proper GraphQL errors
- In-memory LRU cache for player information
- Detailed request and operation logging
- Backed by oversmash, including automated efficient scraping of all hero stats
An oversmash-api reference deployment is available at https://oversmash.com
You can query it, for example, using graphiql-app:
Note: Hosted on Heroku's free tier, so the first request may be extra slow as the application wakes up.
See docs/example.md
oversmash-api
ships with a Dockerfile
. If you have docker installed, you can start it with the following command:
# Build the docker image (only need to do this once, or when you make changes):
docker build -t oversmash-api .
# Run it in the foreground, exposing the default port:
docker run -p 3000:3000 -t -i oversmash-api
oversmash-api
runs out of the box without requiring custom configuration. To customize it, you can:
- Set
NODE_CONFIG
to a JSON string with the configuration values you want to customize (seeconfig/default.yml.example
for the available options) - Copy
config/default.yml.example
toconfig/default.yml
and edit at your leisure.
Uses node-config, which supports a bunch more options.
oversmash-api
uses some newer language features such as async/await
. In order to run it out of the box with your version of nodejs, you will probably need to first build it:
$ npm i # Ensure you have devDependencies installed
$ npm run build
$ npm prune --production # Optional: remove devDependencies, you no longer need them
$ node build/index.js # Start oversmash-api from the newly built build/index.js file
oversmash-api
exposes two endpoints:
POST /graphql
- Standard GraphQL endpointGET /health
- Returns200 OK
as long as oversmash is runningGET /
- Returns200 OK
and a list of available routes
oversmash-api
uses a static schema file bundled with this repo (see: schema.graphql). This file is created from a training set of random (high-ranking) users. To re-generate the schema (e.g to include new achievements, stats or heroes) run:
$ npm run generate-schema
See LICENSE.md
for license information
Contributions are welcome! See CONTRIBUTING.MD
for information.