1.2 KiB
1.2 KiB
QR Code API (Node.js)
Simple micro app that returns a QR code image from an API call.
Setup
npm install
Run
npm run dev
# or
npm start
Default URL: http://localhost:3000
Endpoints
GET /healthGET /api/qr?text=Hello%20WorldPOST /api/qrwith JSON body
GET example
curl "http://localhost:3000/api/qr?text=Hello%20World&size=400" --output qr.png
POST example
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, default512, min128, max2048)margin(number, default2, min0, max10)dark(hex color, default#000000)light(hex color, default#FFFFFF)
Docker
Local Docker run
docker compose -f docker-compose.local.yml up -d --build
Local URL: http://localhost:3000
Production (Traefik)
docker compose -f docker-compose.prod.yml up -d --build
Traefik host rule: qr.crewsportswear.app
Notes:
- Uses external Docker networks:
traefik-publicandcrew-app-net - Internal service port is
3000 - Includes HTTP -> HTTPS redirect via Traefik labels