- Added /admin redirect to login page in nginx config - Fixed backend server.js route ordering for proper admin handling - Updated authentication middleware and routes - Added user management routes - Configured PostgreSQL integration - Updated environment configuration
5.4 KiB
5.4 KiB
🎯 Sky Art Shop - Quick Reference Card
🚀 Start Backend
cd "e:\Documents\Website Projects\Sky_Art_Shop\Admin"
dotnet run --launch-profile https
🔑 Admin Access
URL: https://localhost:5001/admin
User: admin
Pass: admin123
📁 File Structure
Sky_Art_Shop/
├── Admin/ # Backend CMS
│ ├── Controllers/
│ │ ├── AdminController.cs # Admin CRUD
│ │ ├── PublicProductsController.cs
│ │ ├── PublicProjectsController.cs
│ │ ├── PublicBlogController.cs
│ │ └── ... (more public APIs)
│ ├── Models/
│ ├── Views/Admin/ # Admin pages
│ ├── wwwroot/uploads/ # Uploaded images
│ └── Program.cs # CORS + routes
│
├── js/ # Frontend integration
│ ├── api-integration.js # Core API functions
│ ├── shop-page.js
│ ├── portfolio-page.js
│ └── blog-page.js
│
├── css/
│ └── api-styles.css # Card & grid styles
│
├── shop.html # Static pages
├── portfolio.html
├── blog.html
├── index.html
├── about.html
├── contact.html
│
├── test-api.html # Test page
├── INTEGRATION_GUIDE.md # How to integrate
├── IMAGE_FIX_GUIDE.md # Fix images
└── CMS_COMPLETE_GUIDE.md # Full overview
🔗 API Endpoints
| URL | Returns |
|---|---|
/api/products |
All products |
/api/projects |
Portfolio projects |
/api/blog |
Blog posts |
/api/pages/{slug} |
Page content |
/api/categories |
Categories |
/api/settings |
Site settings |
/uploads/products/* |
Product images |
📝 Integration Template
For any HTML page:
<!-- Before </body> -->
<link rel="stylesheet" href="css/api-styles.css">
<script src="js/api-integration.js"></script>
<script src="js/shop-page.js"></script> <!-- or portfolio-page.js, etc. -->
In HTML body:
<div id="productsContainer"></div> <!-- For products -->
<div id="projectsContainer"></div> <!-- For projects -->
<div id="blogContainer"></div> <!-- For blog -->
🧪 Testing
- Test API: Open
test-api.html - Test Page: Open
shop.html(after integration) - Check Console: F12 → Console → Should see "Loaded X items"
- Check Network: F12 → Network → See API calls + images
🐛 Quick Fixes
Images Not Showing
- Admin → Products → Edit
- Upload Main Image
- Save
- Refresh static page
Backend Not Running
cd "e:\Documents\Website Projects\Sky_Art_Shop\Admin"
dotnet run --launch-profile https
CORS Error
Already fixed - CORS enabled in Program.cs
Can't See Products
- Check browser console (F12)
- Verify backend running
- Test with
test-api.html
📂 Image Upload Locations
| Content Type | Upload Folder |
|---|---|
| Products | Admin/wwwroot/uploads/products/ |
| Projects | Admin/wwwroot/uploads/projects/ |
| Blog | Admin/wwwroot/uploads/blog/ |
Served at: https://localhost:5001/uploads/products/<file>
✅ Integration Checklist
- Backend running (https://localhost:5001)
- MongoDB service running
- Products have images uploaded
- Script tags added to HTML pages
- Container divs added to HTML
test-api.htmlshows products with imagesshop.htmlrenders products from API- Browser console shows "Loaded X products"
📚 Documentation
| File | Purpose |
|---|---|
INTEGRATION_GUIDE.md |
Step-by-step for each page |
IMAGE_FIX_GUIDE.md |
Fix missing images |
CMS_COMPLETE_GUIDE.md |
Full overview |
test-api.html |
Test & debug page |
🎯 Workflow
For Client (Content Management):
- Open https://localhost:5001/admin
- Login
- Add/Edit products, projects, blog posts
- Upload images
- Save
- Changes appear on static site immediately
For Developer (Customization):
- Edit
js/api-integration.jsfor custom rendering - Edit
css/api-styles.cssfor styling - Edit HTML pages for layout
- Backend APIs remain unchanged
💡 Pro Tips
- Test First: Always use
test-api.htmlto verify API before integrating - Console is Your Friend: F12 → Console shows all errors
- Images: Upload via Admin Edit, not Create (safer)
- CORS: Already configured for
file://andlocalhost - Production: Change
API_BASEinapi-integration.jswhen deploying
🚀 What's Next?
- Upload images to products (Admin → Products → Edit)
- Integrate HTML pages (add script tags + container divs)
- Test everything with
test-api.html - Customize styles in
api-styles.css - Deploy (optional - see CMS_COMPLETE_GUIDE.md)
Status: ✅ Backend Running | ⚠️ Images Need Upload | 📝 Pages Need Integration
Quick Test: Open file:///E:/Documents/Website%20Projects/Sky_Art_Shop/test-api.html