Unofficial Overwatch API made with Node.js (express, superagent, cheerio, SQLite)
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/ ⬅️⬅️⬅️
You can configure the application by modifying the config/app-config.js
file. Here are the current available options :
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 |
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 |
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 |
npm install
node server.js
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
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
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Copyright © 2017-2020 Valentin PORCHET.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator