Add version number to health endpoint
All checks were successful
CI/CD Pipeline - Apartment API / Scan Dependencies (push) Successful in 13s
CI/CD Pipeline - Apartment API / Build & Push Image (push) Successful in 1m40s
CI/CD Pipeline - Apartment API / Deploy to Production (push) Successful in 15s
CI/CD Pipeline - Apartment API / Lint & Test (push) Successful in 44s
CI/CD Pipeline - Apartment API / Send Webhook Notification (push) Has been skipped
All checks were successful
CI/CD Pipeline - Apartment API / Scan Dependencies (push) Successful in 13s
CI/CD Pipeline - Apartment API / Build & Push Image (push) Successful in 1m40s
CI/CD Pipeline - Apartment API / Deploy to Production (push) Successful in 15s
CI/CD Pipeline - Apartment API / Lint & Test (push) Successful in 44s
CI/CD Pipeline - Apartment API / Send Webhook Notification (push) Has been skipped
Read version from package.json and include it in the /health response so deployed API version can be verified at a glance.
This commit is contained in:
@ -15,6 +15,8 @@ const { createScraperIndexes } = require('./services/scraperService');
|
|||||||
const { initializeScheduler, registerSignalHandlers } = require('./jobs/scraperJob');
|
const { initializeScheduler, registerSignalHandlers } = require('./jobs/scraperJob');
|
||||||
const scraperConfig = require('./config/scraper');
|
const scraperConfig = require('./config/scraper');
|
||||||
|
|
||||||
|
const { version: API_VERSION } = require('./package.json');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const PORT = process.env.PORT || 3000;
|
const PORT = process.env.PORT || 3000;
|
||||||
|
|
||||||
@ -175,6 +177,7 @@ app.use('/admin', adminRoutes);
|
|||||||
app.get('/health', (req, res) => {
|
app.get('/health', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
status: 'ok',
|
status: 'ok',
|
||||||
|
version: API_VERSION,
|
||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString(),
|
||||||
service: 'apartment-api'
|
service: 'apartment-api'
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user