Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soreing/go-wordle-api
A small demo of an API written in Go for playing wordle games
https://github.com/soreing/go-wordle-api
api api-rest gin gin-gonic go golang postgres postgresql postgresql-database wordle
Last synced: 8 days ago
JSON representation
A small demo of an API written in Go for playing wordle games
- Host: GitHub
- URL: https://github.com/soreing/go-wordle-api
- Owner: Soreing
- Created: 2022-06-02T13:49:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-02T14:48:19.000Z (over 2 years ago)
- Last Synced: 2024-10-30T14:50:39.650Z (about 2 months ago)
- Topics: api, api-rest, gin, gin-gonic, go, golang, postgres, postgresql, postgresql-database, wordle
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Demo Go Wordle API
A small project demonstrating APIs written in Go. The project contains an API with different routes to play wordle, and a game manager process that generates new games every 2 hours.API is live at: __gowordle.soreing.site__
## How to Use
### Getting the Current game
To play the game, you need to get an ID for the current game. Along with the ID, you are given a unix timestamp in milliseconds for the expiry date of the game. [Click To Try!](https://gowordle.soreing.site/game/current)
```
GET /game/current
```
```
Output:
{"Id":40,"ExpiresAt":1654184444241}
```
### Creating a Player
Before you can make guesses, you need a player. You can create a player without any required data.
```
POST /player
```
```
Output:
7F11FBEE6AE9DABA
```
### Making a Guess
Once you have a Game Id, a Player and a Word in mind, you can make a guess. The inputs must be sent as x-www-form-urlencoded field by field. If the game is already solved, or all guesses are used, a 400 status is returned with a message.
```
POST /guess
GameId=40&Player=7F11FBEE6AE9DABA&Word=crane
```
```
Output:
Ok (200)
```
### Get Game Status
With a game Id and a player code, you can get your game state with colored letters as follows. Guesses come as an array of strings where each string contains pairs of characters, the capital being the letter and the lower case is the color. [Click To Try!](https://gowordle.soreing.site/game/40/7F11FBEE6AE9DABA)
```
GET /game/:GameId/:PlayerCode
```
```
Output:
{
"Solved": false,
"GuessCount": 2,
"Guesses": [
"bC bR bA bN bE ",
"bL yU bN bG gS "
]
}
```