Spaces:
Runtime error
Runtime error
Download main.js from chartManD/first-space: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/chartManD/first-space/resolve/main/main.js
- Command line
-
hf download hf://spaces/chartManD/first-space/main.js
-
curl -L -o main.js https://huggingface.co/spaces/chartManD/first-space/resolve/main/main.js
1.21 kB
| let express = require("express"); | |
| let bodyParser = require("body-parser"); | |
| let app = express(); | |
| const connectDB = require("./src/database/conection.js"); | |
| const { | |
| getGlucosaByIdUser, | |
| postOneRegisterGlucosa, | |
| } = require("./src/controllers/glucosa-controller.js"); | |
| const { | |
| postOneFood, | |
| getFoodByUserID, | |
| } = require("./src/controllers/alimento-controller.js"); | |
| connectDB(); | |
| const PORT = process.env.PORT || 7860; | |
| // Uso middleware | |
| app.use(express.json()); | |
| // app.use("/assets", express.static(`${__dirname}/public/assets`)); -- Usar con app frond corregida -- | |
| app.use(bodyParser.urlencoded({ extended: false })); | |
| // Endpoints | |
| // app.get("/", (req, res) => { -- Usar con app frond corregida -- | |
| // res.sendFile(`${__dirname}/public/index.html`); | |
| // }); | |
| app.get("/", (req, res) => { | |
| res.sendFile(`${__dirname}/root.html`); | |
| }); | |
| app.get("/api/", (req, res) => { | |
| res.json({ message: "Esta es la raiz del API" }); | |
| }); | |
| app.get("/api/glucosa/:iduser", getGlucosaByIdUser); | |
| app.post("/api/glucosa", postOneRegisterGlucosa); | |
| app.get("/api/alimento/:iduser", getFoodByUserID); | |
| app.post("/api/alimento", postOneFood); | |
| app.listen(PORT, () => { | |
| console.log("La aplicacion esta corriendo"); | |
| }); | |