chitfund/QUICK_BROWSER_TEST.md

160 lines
2.8 KiB
Markdown

# 🌐 Quick Guide: Test APIs in Browser
## ✅ Done! Browser API Tester Created
I've created a beautiful web-based tool for you to test APIs directly from your browser!
---
## 🚀 How to Use (3 Steps)
### Step 1: Restart Backend
```bash
cd backend
npm start
```
### Step 2: Open in Browser
```
https://chitfund.deepteklabs.com/test/api-tester.html
```
Or locally:
```
http://localhost:3000/test/api-tester.html
```
### Step 3: Login & Test!
1. Enter your **manager mobile number**
2. Enter your **password**
3. Click **"Login"**
4. Click **"Get Review Queue"** (or any other endpoint!)
---
## 🎨 What You'll See
Beautiful UI with:
- 🔐 Login form
- 📋 Pre-configured endpoint buttons
- 📊 JSON response viewer
- 💳 UPI settings checker
- 🎨 Modern gradient design
---
## 📋 Pre-configured Buttons
Click these to test instantly:
1. **📋 Get Review Queue**
- Shows transactions needing review
- `/transaction-sync/review-queue`
2. **💳 Get UPI Settings**
- Shows your UPI ID configuration
- `/payments/phonepe/settings/upi`
3. **📊 Get Sync Stats**
- Payment sync statistics
- `/transaction-sync/stats`
Or enter any **custom endpoint**!
---
## 🔧 Files Created
1. **`backend/public/api-tester.html`**
- Web-based API tester
- Beautiful UI
- Auto-authentication
2. **`backend/src/server.js`** (Modified)
- Added static file serving
- Route: `/test`
---
## 💡 Why This is Better
| Feature | Browser Tester | Postman |
|---------|---------------|---------|
| Installation | ✅ None needed | ❌ Download required |
| Authentication | ✅ Auto-handled | Manual token copy |
| UI | ✅ Beautiful | Plain |
| Access | ✅ Any device | Desktop only |
| Setup Time | ⚡ 0 seconds | 5 minutes |
---
## 🎯 Quick Test Example
```
1. Open: https://chitfund.deepteklabs.com/test/api-tester.html
2. Login:
Mobile: 9876543210
Password: your_password
3. Click: "Get UPI Settings"
4. See Response:
{
"success": true,
"data": {
"upi_id": "9876543210@ybl",
"is_configured": true
}
}
```
---
## 📱 Also Works On
- ✅ Desktop browsers
- ✅ Mobile browsers
- ✅ Tablets
- ✅ Any device with internet!
---
## 🔐 Security
- Token stored locally
- Sent with every request
- Manager-only endpoints protected
- Clear token by logging out
---
## 📚 Full Documentation
See **BROWSER_API_TESTER.md** for:
- Complete feature list
- Advanced usage
- Customization guide
- Troubleshooting
---
## ✨ Summary
**You asked:** "What if I want to use browser?"
**I created:**
- ✅ Beautiful web-based API tester
- ✅ No installation needed
- ✅ Auto-authentication
- ✅ Pre-configured endpoints
- ✅ JSON response viewer
**Access now:**
```
https://chitfund.deepteklabs.com/test/api-tester.html
```
**Just restart backend and open the URL!** 🚀