26 أسطر
526 B
JavaScript
26 أسطر
526 B
JavaScript
const express = require('express');
|
|
const app = express();
|
|
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
let requestCount = 0;
|
|
|
|
app.get('/', (req, res) => {
|
|
requestCount++;
|
|
|
|
res.status(200).json({
|
|
message: "Welcome to Ghaymah API",
|
|
total_requests: requestCount
|
|
});
|
|
});
|
|
|
|
app.get('/health', (req, res) => {
|
|
res.status(200).json({
|
|
status: 'UP',
|
|
timestamp: new Date().toISOString()
|
|
});
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Server is running on port ${PORT}`);
|
|
}); |