30 lines
No EOL
656 B
JavaScript
30 lines
No EOL
656 B
JavaScript
import express from 'express';
|
|
import { databaseServices } from '../index.js';
|
|
|
|
export const medicationRouter = express.Router();
|
|
|
|
medicationRouter.get('/', async (req, res) => {
|
|
let data;
|
|
try {
|
|
data = await databaseServices.getMedications();
|
|
res.status(200);
|
|
} catch (err) {
|
|
data = { Error: err?.message };
|
|
res.status(500);
|
|
} finally {
|
|
res.send(data);
|
|
}
|
|
});
|
|
|
|
medicationRouter.get('/base/', async (req, res) => {
|
|
let data;
|
|
try {
|
|
data = await databaseServices.getBaseMedications();
|
|
res.status(200);
|
|
} catch (err) {
|
|
data = { Error: err?.message };
|
|
res.status(500);
|
|
} finally {
|
|
res.send(data);
|
|
}
|
|
}); |