Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/1mt142/leaderboard
https://github.com/1mt142/leaderboard
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/1mt142/leaderboard
- Owner: 1mt142
- Created: 2024-01-26T16:10:27.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-26T16:59:35.000Z (12 months ago)
- Last Synced: 2024-01-26T17:51:31.043Z (12 months ago)
- Language: TypeScript
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Game High Scores API
## Overview
This API allows players to submit their high scores and view the leaderboard for a mobile game.
## Base URL
The base URL for all endpoints is: `http://loaclhost:5008`
## Authentication
The API uses JSON Web Tokens (JWT) for authentication. Include the JWT token in the "Authorization" header using the "Bearer" scheme.
## Endpoints
### 1. Create User
- **URL:** `/user/register`
- **Method:** `POST`
- **Request Payload:**
\_ if you give the user_type :"admin" then it will create user as admin .. by default it's normal user```json
{
"username": "",
"email": "",
"password": ""
}
```### 2. User Login
- **URL:** `/user/login`
- **Method:** `POST`
- **Request Payload:**```json
{
"email": "",
"password": ""
}
```### 3. Submit High Score
- **URL:** `/scores`
- **Method:** `POST`
- \*\*Authorization:Bearer {{token}}
if user is admin then it will take "name":"username" alogwith score
- **Request Payload:**
```json
{
"score": 1000
}
```### 4. Leaderboard
- **URL:** `/leaderboard`
- **Method:** `GET`
- \*\*Authorization:Bearer {{token}}make a Database with is ...
DB_CONNECTION="mysql"
DB_PORT="3306"
DB_USERNAME="root"
DB_PASSWORD="mysql-password"
DATABASE_NAME="backendtask"::: RUN : npm run start:dev