Skip to content

Commit

Permalink
182. Definicion basica de ruta 'uploads'
Browse files Browse the repository at this point in the history
  • Loading branch information
humberto-desk committed Jan 23, 2022
1 parent 904e576 commit e0884bb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules
.env
.env

# Visual Studio Code
.vscode
10 changes: 10 additions & 0 deletions controllers/uploads.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { response } = require("express");
const { models } = require("mongoose");

const cargarArchivo = (req, res = response) => {
res.json({ msg: "Hola mundo" });
};

module.exports = {
cargarArchivo,
};
2 changes: 2 additions & 0 deletions models/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Server {
buscar: "/api/buscar",
categorias: "/api/categorias",
productos: "/api/productos",
uploads: "/api/uploads",
usuarios: "/api/usuarios",
};

Expand Down Expand Up @@ -46,6 +47,7 @@ class Server {
this.app.use(this.paths.buscar, require("../routes/buscar"));
this.app.use(this.paths.categorias, require("../routes/categorias"));
this.app.use(this.paths.productos, require("../routes/productos"));
this.app.use(this.paths.uploads, require("../routes/uploads"));
this.app.use(this.paths.usuarios, require("../routes/usuarios"));
}

Expand Down
13 changes: 13 additions & 0 deletions routes/uploads.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { Router } = require("express");
const { check } = require("express-validator");


const { cargarArchivo } = require("../controllers/uploads");
const { validarCampos } = require("../middlewares/validar-campos");


const router = Router();

router.post('/', cargarArchivo)

module.exports = router;

0 comments on commit e0884bb

Please sign in to comment.