https://github.com/drew138/tictac
API for tic tac toe website
https://github.com/drew138/tictac
backend golang rest-api websocket
Last synced: 12 months ago
JSON representation
API for tic tac toe website
- Host: GitHub
- URL: https://github.com/drew138/tictac
- Owner: drew138
- Created: 2020-10-02T02:46:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-16T02:16:29.000Z (over 5 years ago)
- Last Synced: 2025-03-17T09:49:47.294Z (over 1 year ago)
- Topics: backend, golang, rest-api, websocket
- Language: Go
- Homepage:
- Size: 77.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TICTAC Website API
## Installation
run `go get drew138/tictac` on your local machine.
## Environment Variables
This project implements environment variables to handle sensitive information and various encryption and hashing algorithms.
### Recommended .env file
Although the use of a .env file is not enforced, the following environment variables structure is required:
```
DB_USERNAME=yourDatabaseUsername
DB_PASSWORD=yourDatabasePassword
DB_NAME=yourDatabaseName
DB_HOST=yourDatabaseHost
DB_PORT=yourDatabasePort
JWT_SECRET_KEY=randomJWTSecretKey
JWT_REFRESH_SECRET_KEY=anotherRandomJWTSecretKey
```
## Websocket
The implemented websocket supports the following messages
### Sending Private Message
Sending message:
```
{
"action": "privateMessage",
"recipientID": "oihdfq89ewdfhsdfu80qu8943",
"body": "Hi, how are you?"
}
```
Received message:
```
{
"action": "privateMessage",
"recipientID": "a0sg8enfdls0d72hfla0adimg",
"body": "Hi, how are you?"
}
```
### Sending Game Actions
Sending message:
```
{
"action": "gameAction",
"recipientID": "oihdfq89ewdfhsdfu80qu8943",
"body": "Hi, how are you?"
}
```
Received message:
```
{
"action": "gameAction",
"recipientID": "a0sg8enfdls0d72hfla0adimg",
"body": "Hi, how are you?"
}
```