Merge pull request #17

chore: update README.md
This commit is contained in:
Dawid Wysokiński 2021-06-06 18:54:13 +02:00 committed by GitHub
commit 1ae5d26e7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 41 additions and 21 deletions

View File

@ -1,10 +1,10 @@
# TWHelp API
# tribalwarshelp.com API
A GraphQL API for Tribal Wars data.
A GraphQL API designed for developers who want to create something meaningful for the game [Tribal Wars](https://tribalwars.net).
## Limits
You can fetch in one GraphQL query:
It is possible to fetch in one GraphQL query:
1. 1000 daily player/tribe stats records
2. 200 ennoblements
@ -18,9 +18,7 @@ You can fetch in one GraphQL query:
## Sample queries
You can check how to make requests from JavaScript [here](https://github.com/tribalwarshelp/scripts).
1. All bonus villages with 10% more population
1. Fetch all bonus villages with 10% more population
```graphql
query {
@ -77,12 +75,14 @@ query {
}
}
}
```
More examples [here](https://github.com/tribalwarshelp/scripts).
## Map service
You can generate a server map with this API. The current endpoint is http(s)://youraddress/map/server (replace "server" with the server you're interested in, for example, pl151).
You can generate a server map with this API. The current endpoint is http(s)://youraddress/map/server (replace "server"
with the server you're interested in, for example, pl151).
### Available query params:
@ -99,16 +99,27 @@ You can generate a server map with this API. The current endpoint is http(s)://y
| backgroundColor | #000 |
| gridLineColor | #fff |
| continentNumberColor | #fff |
| tribe(this param you can define multiple times) | format tribeid,hexcolor (for example, tribe=631,#0000ff) |
| player(this param you can define multiple times) | format playerid,hexcolor (for example, player=631,#0000ff) |
| tribe(this param you can define multiple times) | format: tribeid,hexcolor (for example, tribe=631,#0000ff) |
| player(this param you can define multiple times) | format: playerid,hexcolor (for example, player=631,#0000ff) |
### Example
**pl151**
```
https://api.tribalwarshelp.com/map/pl151?showBarbarian=true&tribe=124,%230000ff&tribe=631,%230000ff&tribe=1675,%230000ff&onlyMarkers=false&scale=1&showGrid=true&showContinentNumbers=true
```
![Map](https://api.tribalwarshelp.com/map/pl151?showBarbarian=true&tribe=124,%230000ff&tribe=631,%230000ff&tribe=1675,%230000ff&onlyMarkers=false&scale=1&showGrid=true&showContinentNumbers=true)
## Development
### Prerequisites
1. Golang
2. PostgreSQL database
3. Configured [cron](https://github.com/tribalwarshelp/cron)
### Installation
**Required ENV variables:**
```
@ -118,18 +129,27 @@ DB_PORT=your_pgdb_port
DB_HOST=your_pgdb_host
DB_PASSWORD=your_pgdb_password
LIMIT_WHITELIST=127.0.0.1,::1
LOG_DB_QUERIES=[true|false]
LOG_DB_QUERIES=true
```
### Prerequisites
1. Golang
2. PostgreSQL database
3. Configured [cron](https://github.com/tribalwarshelp/cron)
### Installing
1. Clone this repo.
```
git clone git@github.com:tribalwarshelp/api.git
```
2. Navigate to the directory where you have cloned this repo.
3. Set the required env variables directly in your system or create .env.development file.
4. go run main.go
3. Set the required env variables directly in your system or create .env.local file.
4. Run the app.
```
go run main.go
```
## License
Distributed under the MIT License. See ``LICENSE`` for more information.
## Contact
Dawid Wysokiński - [contact@dwysokinski.me](mailto:contact@dwysokinski.me)