Initialize project and add Netify API integration with TDD workflow
This commit is contained in:
1 parent
8a077cf692
commit
da8fb57bfb
43 files changed
+9230
-115
No files matched your search
@@ -0,0 +1,32 @@
|
||||
// backend/server.js
|
||||
const path = require('path');
|
||||
require('dotenv').config({ path: path.join(__dirname, '..', '.env.local') });
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.BACKEND_PORT || 3001;
|
||||
|
||||
// ── Middleware ────────────────────────────────────────────────────────────────
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// ── API Routes ────────────────────────────────────────────────────────────────
|
||||
const dashboardRoutes = require('./routes/dashboard');
|
||||
app.use('/api/dashboard', dashboardRoutes);
|
||||
|
||||
// ── Health Check ──────────────────────────────────────────────────────────────
|
||||
app.get('/api/health', (req, res) => {
|
||||
res.json({ ok: true, message: 'Netify Dashboard Backend berjalan!', time: new Date().toISOString() });
|
||||
});
|
||||
|
||||
|
||||
// ── Start Server ──────────────────────────────────────────────────────────────
|
||||
app.listen(PORT, () => {
|
||||
console.log(`\n🚀 API Server berjalan di http://localhost:${PORT}`);
|
||||
console.log(`🔌 API Health : http://localhost:${PORT}/api/health\n`);
|
||||
|
||||
// Mulai scheduler polling
|
||||
const { startScheduler } = require('./scheduler');
|
||||
startScheduler();
|
||||
});
|
||||
Reference in new issue
Block a user