Skip to content

Commit bc64946

Browse files
Merge pull request #32 from ngpal/deployment
enhanced deployment flow
2 parents 6d16134 + ef8630e commit bc64946

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ COPY . .
1111

1212
EXPOSE 3000
1313

14-
CMD ["npm", "start"]
14+
CMD ["node", "index.js"]

backend/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,42 @@ app.use(cors(
3131
}
3232
));
3333

34+
// Health check endpoint (used by Elastic Beanstalk for instance monitoring)
35+
app.get('/health', (req, res) => {
36+
res.status(200).json({
37+
status: 'ok',
38+
uptime: process.uptime(),
39+
timestamp: new Date().toISOString()
40+
});
41+
});
42+
43+
// Root dashboard
44+
app.get('/', (req, res) => {
45+
res.send(`
46+
<!DOCTYPE html>
47+
<html>
48+
<head>
49+
<title>Timetable App - Backend</title>
50+
<style>
51+
body { font-family: system-ui, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); color: #f1f5f9; }
52+
.card { text-align: center; padding: 3rem; border-radius: 1rem; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(10px); }
53+
h1 { font-size: 2rem; margin-bottom: 0.5rem; }
54+
.badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 9999px; background: #22c55e; color: #fff; font-size: 0.875rem; font-weight: 600; }
55+
p { color: #94a3b8; margin-top: 1rem; }
56+
</style>
57+
</head>
58+
<body>
59+
<div class="card">
60+
<h1>🎓 Timetable App Backend</h1>
61+
<span class="badge">✓ Running</span>
62+
<p>API is live and healthy</p>
63+
<p style="font-size:0.8rem;">Uptime: ${Math.floor(process.uptime())}s | <a href="/health" style="color:#60a5fa;">Health Check</a> | <a href="/api-docs" style="color:#60a5fa;">API Docs</a></p>
64+
</div>
65+
</body>
66+
</html>
67+
`);
68+
});
69+
3470
// Swagger UI
3571
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
3672

0 commit comments

Comments
 (0)