Spaces:
Sleeping
Sleeping
Dafa commited on
Create health/index.js
Browse files- pages/api/health/index.js +12 -0
pages/api/health/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function handler(req, res) {
|
| 2 |
+
if (req.method === 'GET') {
|
| 3 |
+
res.status(200).json({
|
| 4 |
+
status: 'ok',
|
| 5 |
+
message: 'Server is running',
|
| 6 |
+
timestamp: new Date().toISOString(),
|
| 7 |
+
});
|
| 8 |
+
} else {
|
| 9 |
+
res.setHeader('Allow', ['GET']);
|
| 10 |
+
res.status(405).end(`Method ${req.method} Not Allowed`);
|
| 11 |
+
}
|
| 12 |
+
}
|