chartManD commited on
Commit
489b4aa
·
1 Parent(s): 0d1cedc

prueba de controlador

Browse files
Files changed (2) hide show
  1. main.js +1 -3
  2. src/controllers/glucosa-controller.js +9 -8
main.js CHANGED
@@ -19,9 +19,7 @@ app.get("/", (req, res) => {
19
  res.sendFile(`${__dirname}/root.html`);
20
  });
21
 
22
- app.get("/glucosa", (req, res) => {
23
- res.json({ message: "aggggggggggg" });
24
- });
25
 
26
  app.listen(PORT, () => {
27
  console.log("La aplicacion esta corriendo");
 
19
  res.sendFile(`${__dirname}/root.html`);
20
  });
21
 
22
+ app.get("/glucosa", (req, res) => getAllGlucosa);
 
 
23
 
24
  app.listen(PORT, () => {
25
  console.log("La aplicacion esta corriendo");
src/controllers/glucosa-controller.js CHANGED
@@ -6,14 +6,15 @@ const Glucosa = require("../database/models/glucosa.js");
6
  * @param {import("express").Response} res
7
  */
8
  async function getAllGlucosa(req, res) {
9
- try {
10
- const registros = await Glucosa.find();
11
- res.json(registros);
12
- } catch (error) {
13
- res
14
- .status(500)
15
- .json({ error: "Error al obtener los registros de glucosa" });
16
- }
 
17
  }
18
 
19
  module.exports = {
 
6
  * @param {import("express").Response} res
7
  */
8
  async function getAllGlucosa(req, res) {
9
+ // try {
10
+ // const registros = await Glucosa.find();
11
+ // res.json(registros);
12
+ // } catch (error) {
13
+ // res
14
+ // .status(500)
15
+ // .json({ error: "Error al obtener los registros de glucosa" });
16
+ // }
17
+ res.json({ message: "aggggggggggg" });
18
  }
19
 
20
  module.exports = {