first commit

This commit is contained in:
Frank John Begornia
2026-04-02 14:58:00 +08:00
commit c38837b552
9 changed files with 1394 additions and 0 deletions

71
README.md Normal file
View File

@@ -0,0 +1,71 @@
# QR Code API (Node.js)
Simple micro app that returns a QR code image from an API call.
## Setup
```bash
npm install
```
## Run
```bash
npm run dev
# or
npm start
```
Default URL: `http://localhost:3000`
## Endpoints
- `GET /health`
- `GET /api/qr?text=Hello%20World`
- `POST /api/qr` with JSON body
### GET example
```bash
curl "http://localhost:3000/api/qr?text=Hello%20World&size=400" --output qr.png
```
### POST example
```bash
curl -X POST "http://localhost:3000/api/qr" \
-H "Content-Type: application/json" \
-d '{"text":"https://crewsportswear.app","size":500,"margin":2}' \
--output qr.png
```
## Optional parameters
- `size` (number, default `512`, min `128`, max `2048`)
- `margin` (number, default `2`, min `0`, max `10`)
- `dark` (hex color, default `#000000`)
- `light` (hex color, default `#FFFFFF`)
## Docker
### Local Docker run
```bash
docker compose -f docker-compose.local.yml up -d --build
```
Local URL: `http://localhost:3000`
### Production (Traefik)
```bash
docker compose -f docker-compose.prod.yml up -d --build
```
Traefik host rule: `qr.crewsportswear.app`
Notes:
- Uses external Docker networks: `traefik-public` and `crew-app-net`
- Internal service port is `3000`
- Includes HTTP -> HTTPS redirect via Traefik labels