Completed the server setup for health checkup

This commit is contained in:
Mosiur Rahman
2026-04-21 19:04:07 +06:00
parent cff98994fd
commit 3a414cfabd
2 changed files with 43 additions and 0 deletions

29
server/src/server.ts Normal file
View File

@@ -0,0 +1,29 @@
import express, {Application, Request, Response} from 'express';
import cors from 'cors';
import {ENV} from './config/env';
import connectDB from './config/db';
const app: Application = express()
app.use(cors ())
app.use(express.json())
app.get('/health', (_req: Request, res: Response)=> {
res.json({
status: 'ok',
environment: ENV.NODE_ENV,
timestamp: new Date().toISOString(),
});
});
//start Server
const start = async (): Promise<void> => {
await connectDB();
app.listen(ENV.PORT, () => {
console.log(`Server running on port ${ENV.PORT}`)
});
};
start();