Files
homelab-topology/server/routes/AGENTS.md
Christopher Mayor 6dd679b8e0 feat: integrate all 10 skills into homelab-topology
- Added api-security-hardening (helmet, rate limits)
- Added nodejs-backend-patterns (error handling)
- Added observability-monitoring (pino logging)
- Added websocket-engineer (socket.io real-time updates)
- Added docker (Multi-stage build, compose)
- Added vitest (testing configuration and store tests)
- Added data-visualizer (MetricsBar and HostChart)
- Added infrastructure-monitoring/proxmox-admin/network-engineer types
- Fixed UI accessibility and styling
- Cleaned up node_modules tracking
2026-02-20 20:35:08 -08:00

50 lines
1.2 KiB
Markdown

# Server Routes (API Endpoints)
**Generated:** 2026-02-19
**Location:** server/routes/
## OVERVIEW
Express router modules exposing REST API endpoints for the homelab topology.
## ENDPOINTS
| File | Route | Method | Purpose |
|------|-------|--------|---------|
| discover.ts | /api/discover | POST | Run SSH discovery on specified hosts |
| config.ts | /api/config | GET/PUT | Get or update configuration |
| stats.ts | /api/stats | GET | Retrieve statistics |
| files.ts | /api/files | GET | Get file topology |
## ADDING A NEW ENDPOINT
1. Create `server/routes/{name}.ts`:
```typescript
import { Router } from 'express';
const router = Router();
router.get('/{name}', (req, res) => {
// implementation
});
export default router;
```
2. Import and mount in `server/index.ts`:
```typescript
import newRouter from './routes/{name}';
app.use('/api', newRouter);
```
## CONVENTIONS
- All routes prefixed with `/api` (mounted in index.ts)
- Return JSON on success: `{ data: ... }`
- On error: `{ error: string }`
- Use async/await for async operations
## NOTES
- discover.ts: Main endpoint - accepts host list, returns topology data
- CORS is configured at server/index.ts level, not per-route