File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as authController from './controllers/authController';
3
3
import * as categoryController from './controllers/categoryController' ;
4
4
import * as settingsController from './controllers/settingsController' ;
5
5
import * as taskController from './controllers/taskController' ;
6
+ import db from './db' ;
6
7
import { authenticateToken } from './middleware/authMiddleware' ;
7
8
8
9
const router = express . Router ( ) ;
@@ -30,4 +31,15 @@ router.post("/check-email", authController.checkEmail);
30
31
router . get ( '/settings' , authenticateToken , settingsController . getSettings ) ;
31
32
router . put ( '/settings' , authenticateToken , settingsController . updateSettings ) ;
32
33
34
+ // Health Check
35
+ router . get ( '/health' , async ( req , res ) => {
36
+ try {
37
+ await db . raw ( 'SELECT 1' ) ; // Quick DB connectivity check
38
+ res . send ( 'ok' ) ;
39
+ } catch ( error ) {
40
+ console . error ( 'Health check failed:' , error ) ;
41
+ res . status ( 503 ) . send ( 'error' ) ;
42
+ }
43
+ } ) ;
44
+
33
45
export default router ;
You can’t perform that action at this time.
0 commit comments