Spaces:
Runtime error
Runtime error
creados git ignore, dabese/ y probar variables de entono con js
Browse files- .gitignore +1 -0
- database/conection.js +6 -0
- database/schemas/alimento.js +11 -0
- database/schemas/glucosa.js +9 -0
- database/schemas/usuario.js +14 -0
- main.js +3 -0
.gitignore
CHANGED
|
@@ -11,6 +11,7 @@ node_modules
|
|
| 11 |
dist
|
| 12 |
dist-ssr
|
| 13 |
package-lock.json
|
|
|
|
| 14 |
*.local
|
| 15 |
|
| 16 |
# Editor directories and files
|
|
|
|
| 11 |
dist
|
| 12 |
dist-ssr
|
| 13 |
package-lock.json
|
| 14 |
+
.env
|
| 15 |
*.local
|
| 16 |
|
| 17 |
# Editor directories and files
|
database/conection.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
let moogose = require("mongoose");
|
| 2 |
+
|
| 3 |
+
moogose.connect(process.env.MONGO_URI, {
|
| 4 |
+
useNewUrlParser: true,
|
| 5 |
+
useUnifiedTopology: true,
|
| 6 |
+
});
|
database/schemas/alimento.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const mongoose = require("mongoose");
|
| 2 |
+
|
| 3 |
+
const alimento = new mongoose.Schema({
|
| 4 |
+
nombre: String,
|
| 5 |
+
proteinas: Number,
|
| 6 |
+
calorias: Number,
|
| 7 |
+
carbohidratos: Number,
|
| 8 |
+
grasas: Number,
|
| 9 |
+
createdAt: { type: Date, default: Date.now },
|
| 10 |
+
iduser: String,
|
| 11 |
+
});
|
database/schemas/glucosa.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const mongoose = require("mongoose");
|
| 2 |
+
|
| 3 |
+
const glucosa = new mongoose.Schema({
|
| 4 |
+
glucosa: { type: Number, required: true },
|
| 5 |
+
ayuno: Boolean,
|
| 6 |
+
comentario: { type: String, default: null },
|
| 7 |
+
createdAt: { type: Date, default: Date.now },
|
| 8 |
+
iduser: String,
|
| 9 |
+
});
|
database/schemas/usuario.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const mongoose = require("mongoose");
|
| 2 |
+
|
| 3 |
+
const usuario = new mongoose.Schema({
|
| 4 |
+
nombre: String,
|
| 5 |
+
apellido: String,
|
| 6 |
+
username: String,
|
| 7 |
+
password: String,
|
| 8 |
+
edad: Number,
|
| 9 |
+
altura: Number,
|
| 10 |
+
peso: Number,
|
| 11 |
+
genero: String,
|
| 12 |
+
tipo_diabetes: String,
|
| 13 |
+
actividad_fisica: String,
|
| 14 |
+
});
|
main.js
CHANGED
|
@@ -15,6 +15,9 @@ app.use(bodyParser.urlencoded({ extended: false }));
|
|
| 15 |
// res.sendFile(`${__dirname}/public/index.html`);
|
| 16 |
// });
|
| 17 |
app.get("/", (req, res) => {
|
|
|
|
|
|
|
|
|
|
| 18 |
res.sendFile(`${__dirname}/root.html`);
|
| 19 |
});
|
| 20 |
|
|
|
|
| 15 |
// res.sendFile(`${__dirname}/public/index.html`);
|
| 16 |
// });
|
| 17 |
app.get("/", (req, res) => {
|
| 18 |
+
console.log(
|
| 19 |
+
process.env.MONGO_URI || "No se ha cargado la variable de entorno"
|
| 20 |
+
);
|
| 21 |
res.sendFile(`${__dirname}/root.html`);
|
| 22 |
});
|
| 23 |
|