File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ const flash = require('connect-flash')
1010const i18n = require ( "i18n" )
1111const moment = require ( 'moment' )
1212const redis = require ( 'redis' )
13+ const fetch = require ( 'node-fetch' )
14+ const { URL , resolve } = require ( 'url' )
15+
1316
1417const config = require ( './config' )
1518const dmsRoutes = require ( './routes/dms' )
@@ -119,6 +122,28 @@ module.exports.makeApp = function () {
119122 // enable flash messages
120123 app . use ( flash ( ) )
121124
125+ /*
126+ Route to check the status of the application by
127+ calling the package_search of backend with row count as 0
128+ to check whether the application is returning response or not
129+ */
130+ app . get ( '/status' , async ( req , res ) => {
131+ const url = resolve (
132+ config . get ( 'API_URL' ) ,
133+ `package_search?rows=0`
134+ )
135+ const response = await fetch ( url )
136+ if ( response . ok ) {
137+ const body = await response . json ( )
138+ if ( body . success == true ) {
139+ res . status ( 200 ) . send ( 'Ok' )
140+ } else {
141+ res . status ( 500 ) . send ( 'Not Ok' )
142+ }
143+
144+ }
145+ } )
146+
122147 // Auth
123148 if ( authEnabled ) {
124149 authRoutes ( app )
You can’t perform that action at this time.
0 commit comments