Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

TeKrop/overwatch-api

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🎮 Overwatch API

Version Docker Build Issues Documentation License: MIT Mockup Overwatch API

Unofficial Overwatch API made with Node.js (express, superagent, cheerio, SQLite)

⚠️⚠️⚠️ WARNING ⚠️⚠️⚠️

⚠️⚠️⚠️ THIS API IS NOW DEPRECATED, THERE WILL BE NO FUTURE UPDATE ⚠️⚠️⚠️

Please use my new API, which is more complete and have much better responses time thanks to a specific cache system :

➡️➡️➡️ https://overfast-api.tekrop.fr/ ⬅️⬅️⬅️

Table of contents

🛠️ Configuration

You can configure the application by modifying the config/app-config.js file. Here are the current available options :

Basic server configuration

Variable Default value Description
SERVER_PORT 8081 Server port to use
SWAGGER_URL 'https://swagger-owapi.tekrop.fr/' URL of Swagger page for the API

Logs configuration

Variable Default value Description
ENABLE_LOGS true Enable file logging. If you want to handle logs externally, put this value to false
LOG_LEVEL 'verbose' Log levels, corresponding to Node.js levels : error, warn, info, verbose, debug
LOG_PATH './logs' Logs storage location
LOG_FILENAME 'overwatch-api-%DATE%.log' Logs filename pattern (daily logs)
ZIP_LOGS true Whether or not the app should zip the logs when the day is over

External calls configuration

Variable Default value Description
BLIZZARD_HOST 'https://playoverwatch.com' Blizzard Overwatch website hostname, base url for career and heroes path
CAREER_PATH '/en-us/career/' Path for Overwatch players career profiles on Blizzard website
HEROES_PATH '/en-us/heroes/' Path for Overwatch heroes pages on Blizzard website

💽 Installation

npm install
node server.js

🐋 Docker

First step : build an overwatch-api image yourself

docker build https://github.com/TeKrop/overwatch-api.git#master -t tekrop/overwatch-api:latest

OR

docker build . -t tekrop/overwatch-api:latest

You can set the application configuration on container launch using environment variables, with names like OW_API_<CONFIG_VARIABLE>. Example : OW_API_SERVER_PORT. If no environment variable is specified, the default values are used by the application. You can also create a volume in order to consult the application logs outside of the container. Here are some examples :

Simple launch (no logs volume, default config values)

docker run -d \
    --name overwatch-api \
    -p 80:8081 \
    tekrop/overwatch-api

Advanced launch (logs volume and override config, or just no log files)

docker run -d \
    --name overwatch-api \
    -p 80:8081 \
    --volume <local_path_to_logs>:/usr/src/app/logs \
    --env OW_API_LOG_LEVEL="info"\
    tekrop/overwatch-api
docker run -d \
    --name overwatch-api \
    -p 80:8081 \
    --env OW_API_ENABLE_LOGS="false" \
    tekrop/overwatch-api

👨‍💻 Technical details

Important : In the API, all time values are returned in seconds (integer) thanks to some conversions. I built the API in order to always return an integer/float value when we are dealing with numbers (and not a string).

For code syntax and style, I'm using Airbnb JS Style Guide (https://github.com/airbnb/javascript). I'm using Node.js along with Express as the main framework. In order to retrieve data from Blizzard profile pages, I'm using superagent along with cheerio to make request on the DOM. Finally, I made a simple cache system using SQLite, working with ETag returned by Blizzard profile pages headers. For code

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

📝 License

Copyright © 2017-2020 Valentin PORCHET.

This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator