feat: add Node.js/Express API with real data from Desk CRM
- ✅ API completa em /api com TypeScript - ✅ Google Calendar integration (pessoal + profissional) - ✅ Queries diretas à BD: tasks, leads, projectos, billing, pipeline - ✅ Endpoints: /api/dashboard, /api/monitor, /api/health - ✅ Vite proxy configurado (/api → localhost:3001) - ✅ App.tsx usa /api/dashboard (não mais dados mock) - ✅ Migração completa do PHP (index.php + monitor.php) - ✅ CHANGELOG.md criado para tracking - ✅ Scripts npm: dev (paralelo), dev:api, dev:ui, start Dependencies: - express, cors, mysql2, googleapis - concurrently, tsx (dev) Breaking: PHP backend será descontinuado See: CHANGELOG.md, api/README.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
22
api/routes/monitor.ts
Normal file
22
api/routes/monitor.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Monitor API Route
|
||||
* GET /api/monitor
|
||||
* @author Descomplicar® | @link descomplicar.pt | @copyright 2026
|
||||
*/
|
||||
import { Router } from 'express'
|
||||
import type { Request, Response } from 'express'
|
||||
import * as monitoringService from '../services/monitoring.js'
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const data = await monitoringService.getMonitoringData()
|
||||
res.json(data)
|
||||
} catch (error) {
|
||||
console.error('Monitor API error:', error)
|
||||
res.status(500).json({ error: 'Internal server error' })
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user