I have been working as a poker dealer for over 10 years. Every day I work I need to deal with poker tournaments and looking at the tournament clocks all the time. An idea came up to me I want to make my tournament clock one day and share it with everyone.
Here is the project. Everyone can find tournaments and see the real-time updated clocks online. Tournament hosts can run the same tournament in different rooms even in different cities, everyone would see the same clock with the same information no matter where you are.
Sunbao Wu@yb7984
Email: bobowu@outlook.com
Linkedin: https://www.linkedin.com/in/sunbao-wu/
- Tour For All Frontend hosted on Surge
- Tour For All Backend hosted on Heroku
- Frontend: tour-for-all-react
- Backend: tour-for-all-express
Please check it out at tour-for-all-react.
Returns JWT token which can be used to authenticate further requests.
POST /auth/token
{
"username": "your username",
"password": "your password"
}
if successfully login, return status 201
{
"token": "Your token"
}
else
{
"error": {
"message": "Invalid username/password",
"status": 401
}
}
Returns JWT token which can be used to authenticate further requests.
POST /auth/register
{
"username": "your username",
"password": "your password",
"firstName": "first name",
"lastName": "last name",
"email": "email"
}
if successfully, return status 201
{
"token": "Your token"
}
else
{
"error": {
"message": "Duplicate username:<your username>",
"status": 400
}
}
Returns list of all users.
GET /users
{}
{
users: [user1, user2]
}
Returns User.
GET /users/:username
{}
{
user: User
}
Adds a new user.This returns the newly created user and an authentication token for them.
POST /users
{
"username": "your username",
"password": "your password",
"firstName": "first name",
"lastName": "last name",
"email": "email",
"role": 0 or 1
}
if successfully, return status 201
{
"user": User
"token": "Your token"
}
else
{
"error": {
"message": "Bad Request",
"status": 400
}
}
{
"error": {
"message": "Duplicate username:",
"status": 400
}
}
Update a user.This returns the updated user.
PATCH /users/:username
{
"password": "your password",
"firstName": "first name",
"lastName": "last name",
"email": "email",
"phone":"XXXXXXXXXX",
"image":"image",
"role": 0 or 1
}
if successfully, return status 200
{
"user": User
}
else
{
"error": {
"message": "Bad Request",
"status": 400
}
}
Delete a User
DELETE /users/:username
{
}
##### **Response**
```json
{
"deleted": username
}
OR
if this user has joined or created some tournaments
{
"deactivated": username
}
Returns list of tours.
GET /tours
param | value |
---|---|
listType |
any of private,joined,upcoming,all,running,past,cancel,favorite |
username |
current username |
term |
search term |
creator |
username of tournament creator |
isActive |
true or false |
status |
any of 0,1,9,10 |
minPrice |
minimum price, must be 0 or greater |
maxPrice |
maxmum price, must be 0 or greater |
minGuaranteed |
minimum guaranteed, must be 0 or greater |
maxGuaranteed |
minimum guaranteed, must be 0 or greater |
page |
current page, must be 1 or greater |
perPage |
record per page, must be 1 or greater |
{
tours: [tour1, tour2 , ....],
page,
total,
perPage
}
Returns Tour.
GET /tours/:handle
handle can be id or slug
{}
{
tour: Tour
}
Adds a new tour.This returns the newly created tour.
POST /tours
{
"slug": "tour slug",
"title": "title", // required
"image": "image",
"guaranteed": "guaranteed prize pool, integer of 0 or greater",
"stack": "chip stack, integer of 1 or greater",
"description": "description",
"price": "purchase price, integer of 0 or greater",
"entryFee": "entry fee, integer of 0 or greater",
"start": "start time of tour, string of datetime", //required
"setting": "stringified json object",
}
if successfully, return status 201
{
"tour": Tour
}
else
{
"error": {
"message": "Bad Request",
"status": 400
}
}
Update a tour. This return a updated Tour.
PATCH /tours/:handle
{
"slug": "tour slug",
"title": "title",
"image": "image",
"guaranteed": "guaranteed prize pool, integer of 0 or greater",
"stack": "chip stack, integer of 1 or greater",
"description": "description",
"price": "purchase price, integer of 0 or greater",
"entryFee": "entry fee, integer of 0 or greater",
"start": "start time of tour, string of datetime",
"setting": "stringified json object",
"clockSetting": "stringified json object",
"status": "tour status, integer",
"isActive": true or false
}
if successfully, return status 200
{
"tour": Tour
}
else
{
"error": {
"message": "Bad Request",
"status": 400
}
}
Delete a Tour.
DELETE /tours/:handle
{
}
##### **Response**
```json
{
"deleted": tourId
}
OR
if this tour has started
{
"deactivated": tourId
}
Follow a Tour.
POST /tours/:handle/follow/:username
{
}
##### **Response**
```json
{
"defollow": tourId
}
Defollow a Tour.
DELETE /tours/:handle/follow/:username
{
}
##### **Response**
```json
{
"follow": tourId
}
Attend a tour
POST /tours/:handle/players/:username
{
}
##### **Response**
```json
{
"player": TourPlayer
}
Update a tour player
PATCH /tours/:handle/players/:username
{
"prize": "the prize the player got",
"place": "Integer, the place of the player got at the tour"
}
##### **Response**
```json
{
"player": TourPlayer
}
Unattend a tour
DELETE /tours/:handle/players/:username
{
}
##### **Response**
```json
{
"deleted": username
}
WS /tours/:handle/clock
Messages
- Join
{
"type": "join",
"name": "username" or uuid(),
"clockManager": true or false
}
- Sync
{
"type": "sync",
"data": Clock
}
To run this project, you will need to add the following environment variables to your .env file
param | default value | description |
---|---|---|
SECRET_KEY |
secret-dev | Secret key for this app |
PORT |
3002 | the port running for this app |
NODE_ENV |
set to "test" when doing the test | |
DATABASE_URL |
tour_for_all_test when testing, tour_for_all when not testing | |
UPLOAD_DIR |
uploads | the folder name for uploading data |
UPLOAD_URL |
/uploads | the url for upload folder |
S3_UPLOAD |
false | if the app using amazon s3 to upload image |
AWS_ACCESS_KEY_ID |
access key id for amazon service | |
AWS_SECRET_ACCESS_KEY |
access key for amazon service | |
AWS_S3_BUCKET |
tourforall | amazon s3 bucket name |