Test deploy #31
1 changed files with 5 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
|
import fs from 'fs/promises';
|
||||||
import { medicationRouter } from './services/medications/index.js';
|
import { medicationRouter } from './services/medications/index.js';
|
||||||
import { shiftsRouter } from './services/shifts/index.js';
|
import { shiftsRouter } from './services/shifts/index.js';
|
||||||
import { shiftRunQuery } from './services/shiftConnection.js';
|
import { shiftRunQuery } from './services/shiftConnection.js';
|
||||||
|
|
@ -45,9 +46,12 @@ app.get('/api/db-health', async (req, res) => {
|
||||||
res.status(500).json({ connected: false, error: err.message });
|
res.status(500).json({ connected: false, error: err.message });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/api/version', async (req, res) => {
|
app.get('/api/version', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
res.json('1.0.9');
|
const packageData = await fs.readFile('./package.json', 'utf8');
|
||||||
|
const pkg = JSON.parse(packageData);
|
||||||
|
res.json(pkg.version);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res.status(500).json({ connected: false, error: err.message });
|
res.status(500).json({ connected: false, error: err.message });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue