added another API for db connection
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import express, {Application, Request, Response} from 'express';
|
||||
import cors from 'cors';
|
||||
import {ENV} from './config/env';
|
||||
import connectDB from './config/db';
|
||||
import {connectDB, readyState} from './config/db';
|
||||
|
||||
const app: Application = express()
|
||||
|
||||
@@ -16,6 +16,16 @@ app.get('/health', (_req: Request, res: Response)=> {
|
||||
});
|
||||
});
|
||||
|
||||
//for checking database connection
|
||||
|
||||
app.get('/health/db', (req: Request, res: Response)=> {
|
||||
res.json({
|
||||
db_status: readyState(),
|
||||
environment: ENV.NODE_ENV,
|
||||
timestamp: new Date().toISOString()
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
//start Server
|
||||
|
||||
|
||||
Reference in New Issue
Block a user