MoonMiners/README.md
Joseph Ferano 9b753cf103 Porting database from SQLite to PostgreSQL
- New Postgres table schemas
- Using Stored Procedures with transactions that validate business logic
- User Ids now use UUID
- Updated and simplified all endpoints to call the stored procedures

Notes: There are still a few things missing that broke because of the migration,
in particular, because we moved a lot of the business logic into the database,
we now require that certain data that lived in the game-config.json to be
present in the database as well, to prevent cheating and truly have a single
source of truth.
2023-03-30 14:13:30 +07:00

39 lines
729 B
Markdown

#Moon Miners
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```
## Dotenv
Fill the following out:
```dotenv
DB_USER=
DB_PASSWORD=
DB_HOST=
DB_PORT=
DB_DATABASE=
```
## API Endpoints
POST `/user/login` check if user exists
GET `/user/USER_ID/stakes` get stake event
POST `/user/USER_ID/stakes/claim` claim stake
POST `/user/USER_ID/stakes/start` start stake
GET `/user/USER_ID/bank-account` get balance
PUT `/user/USER_ID/bank-account` sell resource
GET `/user/USER_ID/inventory-items` get inventory items
POST `/user/USER_ID/inventory-items` buy item
GET `/user/USER_ID/staking-sources` get staking sources
POST `/user/USER_ID/staking-sources` create staking source