Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brkn/typeorm-express-example
Typeorm express example
https://github.com/brkn/typeorm-express-example
express heroku postgresql typeorm typescipt
Last synced: 29 days ago
JSON representation
Typeorm express example
- Host: GitHub
- URL: https://github.com/brkn/typeorm-express-example
- Owner: brkn
- Created: 2020-06-22T09:52:58.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T22:26:11.000Z (about 2 years ago)
- Last Synced: 2024-12-15T23:29:10.926Z (about 1 month ago)
- Topics: express, heroku, postgresql, typeorm, typescipt
- Language: TypeScript
- Homepage:
- Size: 2.08 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Typeorm Express Example
## Endpoints
- `GET /leaderboard`
returns
```json
[
{
"user_id": "995ea63a-5ecc-4f18-b271-5f46f661c975",
"display_name": "DN_995ea63a-5ecc-4f18-b271-5f46f661c975",
"country": "fr",
"points": 3493,
"rank": "1"
},
{
"user_id": "0ac1a298-db42-4881-8f2b-3eff152f4609",
"display_name": "DN_0ac1a298-db42-4881-8f2b-3eff152f4609",
"country": "ca",
"points": 3475,
"rank": "2"
},
{
"user_id": "2b945048-8d68-4992-8089-6cf46bf27dc9",
"display_name": "DN_2b945048-8d68-4992-8089-6cf46bf27dc9",
"country": "fr",
"points": 1005,
"rank": "499"
}
]
```- `GET /leaderboard/`
ex: `/leaderboard/fr` returns
```json
[
{
"user_id": "995ea63a-5ecc-4f18-b271-5f46f661c975",
"display_name": "DN_995ea63a-5ecc-4f18-b271-5f46f661c975",
"country": "fr",
"points": 3493,
"rank": "1"
},
{
"user_id": "2b945048-8d68-4992-8089-6cf46bf27dc9",
"display_name": "DN_2b945048-8d68-4992-8089-6cf46bf27dc9",
"country": "fr",
"points": 1005,
"rank": "499"
}
]
```- `POST /user/create`
ex payload:
```json
{
"user_id": "string",
"display_name": "string",
"country": "tr",
"points": 123.456
}
```Note: Sending a ranking inside the payload is not allowed. This is intentional.
- `POST /user/create/batch`
ex payload:
```json
[
{
"user_id": "string",
"display_name": "string",
"country": "string",
"points": 123.456
},
{
"user_id": "string",
"display_name": "string",
"country": "string",
"points": 123.456
}
]
```- `POST /user/create/batch-random`
ex payload:
```json
{
"count": 123456
}
```- `GET /user/profile/`
ex response:
```json
{
"user_id": "995ea63a-5ecc-4f18-b271-5f46f661c975",
"display_name": "DN_995ea63a-5ecc-4f18-b271-5f46f661c975",
"country": "fr",
"points": 3493,
"rank": "1"
}
```- `POST /score/submit`
ex payload:
```json
{
"user_id": "string",
"timestamp": "string",
"score_worth": 123.345
}
```## Local development
1. Create dotenv file
- `cp .env.dev .env`
2. Install dependencies
- `yarn`
3. Run migrations
- `yarn typeorm migrations:run`
4. Run server
- `yarn dev`