https://github.com/jusemon/reflex-api
A simple API to save and get RefleX higher scores
https://github.com/jusemon/reflex-api
Last synced: 11 months ago
JSON representation
A simple API to save and get RefleX higher scores
- Host: GitHub
- URL: https://github.com/jusemon/reflex-api
- Owner: jusemon
- License: mit
- Created: 2023-06-11T20:23:21.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-04T17:25:03.000Z (over 1 year ago)
- Last Synced: 2025-01-31T08:15:25.812Z (over 1 year ago)
- Language: TypeScript
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RefleX API
An API for save and get the top 10 scores of the
[RefleX](https://github.com/jusemon/reflex) game.
## Requirements
- Last stable version of MySQL (8 or greater)
- A PC with node.js (16 or greater) or docker
## Installation
For run locally it needs a `.env` file with the environment variables defined in
the `.env.example`
The database scripts are under the scripts folder, please run them in order.
### Development
ALLOWED_ORIGINS includes a comma-separated list of the allowed CORS sites.
Install dependencies `npm install` or `yarn` To start the project run
`npm run dev` or `yarn dev`
### Production
For run it in docker just run `docker compose up`
Alternatively, you can run the image without cloning this repo using the image
published
[here](https://git.jusemon.com/jusemon/-/packages/container/reflex-api/1.0.0)
With docker run (replace ${ENV_VARIABLE} with your values):
```sh
docker run -p ${PORT}:${PORT} -e NODE_ENV=${NODE_ENV} -e HOST=${HOST} -e PORT=${PORT} -e API_VERSION=${API_VERSION} -e ALLOWED_ORIGINS=${ALLOWED_ORIGINS} -e DB_HOST=${DB_HOST} -e DB_DATABASE=${DB_DATABASE} -e DB_USER=${DB_USER} -e DB_PASSWORD=${DB_PASSWORD} -e DB_PORT=${DB_PORT} -e COUNTRY_SERVICE=${COUNTRY_SERVICE} git.jusemon.com/jusemon/reflex-api:1.0.0
```
With docker compose (the ${ENV_VARIABLE} will be taken from the .env
automatically):
```yaml
name: reflex
services:
api:
image: git.jusemon.com/jusemon/reflex-api:1.0.0
ports:
- ${PORT}:${PORT}
environment:
NODE_ENV: ${NODE_ENV}
HOST: ${HOST}
PORT: ${PORT}
API_VERSION: ${API_VERSION}
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS}
DB_HOST: ${DB_HOST}
DB_DATABASE: ${DB_DATABASE}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_PORT: ${DB_PORT}
COUNTRY_SERVICE: ${COUNTRY_SERVICE}
```
## Libraries Used
- koa (for api rest)
- mysql2 (for database operations)
## Credits
- Created by Juan Sebastián Montoya
## License
This project is licensed under the
[MIT License](https://opensource.org/licenses/MIT).