Adding documentation
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -311,3 +311,7 @@ poetry.toml
|
||||
pyrightconfig.json
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/node,python
|
||||
|
||||
# Codetyper.nvim - AI coding partner files
|
||||
*.coder.*
|
||||
.coder/
|
||||
|
||||
59
README.md
Normal file
59
README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
QR Code App
|
||||
|
||||
This repository contains a simple QR-code backend (FastAPI) and a React + Vite frontend.
|
||||
|
||||
Prerequisites
|
||||
- Python 3.10+ (for backend)
|
||||
- Node.js (18+) and npm (for frontend)
|
||||
|
||||
Backend (FastAPI)
|
||||
|
||||
1) Create and activate a virtual environment
|
||||
|
||||
```bash
|
||||
python3 -m venv backend/.venv
|
||||
source backend/.venv/bin/activate # macOS / Linux
|
||||
```
|
||||
|
||||
2) Install Python dependencies
|
||||
|
||||
```bash
|
||||
pip install -r backend/requirements.txt
|
||||
```
|
||||
|
||||
3) Run the backend (development)
|
||||
|
||||
```bash
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 5001 --reload
|
||||
|
||||
# option B (uses the included runner)
|
||||
python backend/main.py
|
||||
```
|
||||
|
||||
The backend listens on port 5001 by default and exposes the QR generator at:
|
||||
|
||||
POST http://localhost:5001/api/qrcode/generate
|
||||
|
||||
Payload JSON shape: { "text": "string", "size": number }
|
||||
Response: image/png (binary image bytes)
|
||||
|
||||
Frontend (React + Vite)
|
||||
|
||||
1) Install dependencies and run dev server
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Vite's dev server typically serves at http://localhost:5173. The frontend is configured to call the backend at http://localhost:5001 (see frontend/src/api/qrcode.ts). Ensure the backend is running before using the UI.
|
||||
|
||||
Notes
|
||||
|
||||
- CORS is enabled in the backend for local development.
|
||||
- If you change backend port, update the host constant in `frontend/src/api/qrcode.ts`.
|
||||
|
||||
Author
|
||||
|
||||
- Carlos Gutierrez <cgutierrez44833@ucumberlands.edu>
|
||||
Reference in New Issue
Block a user