Skip to content

Commit

Permalink
Add data at /health route
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeoriani committed Apr 9, 2024
1 parent 578baae commit 31f7b56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Router } from 'express'
import tasks from './tasks.js'
import auth from './auth.js'
import { config } from '../utils/config.js'

const routes = Router()

Expand All @@ -9,7 +10,11 @@ routes.get('/', (_, res) => {
})

routes.get('/health', (_, res) => {
return res.status(200).send()
return res.status(200).send({
success: true,
hostname: config.host,
environment: config.nodeEnv,
})
})

routes.use(auth)
Expand Down
1 change: 0 additions & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const config = {
isTest: nodeEnv === NodeEnv.Test,
host: os.hostname(),
port: getEnvironmentVariable<number>('PORT') || 3000,
salt: getEnvironmentVariable<string>('SALT'),
tokenSecret: getEnvironmentVariable<string>('JWT'),
tokenExpiration: '1d',
}

0 comments on commit 31f7b56

Please sign in to comment.