listo para servidor de prubas
This commit is contained in:
@@ -6,6 +6,16 @@ const csv = require(`${controllerPath}/csv`);
|
||||
const registrar = require(`${controllerPath}/registrar`);
|
||||
|
||||
// POST
|
||||
app.post(`${route}/csv`, (req, res) => {
|
||||
return csv(req.body)
|
||||
.then((data) => {
|
||||
res.download(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
app.post(`${route}/registrar`, (req, res) => {
|
||||
return registrar(req.body)
|
||||
.then((data) => {
|
||||
@@ -16,15 +26,4 @@ app.post(`${route}/registrar`, (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
// GET
|
||||
app.get(`${route}/csv`, (req, res) => {
|
||||
return csv(req.query)
|
||||
.then((data) => {
|
||||
res.download(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
@@ -6,6 +6,17 @@ const csv = require(`${controllerPath}/csv`);
|
||||
const get = require(`${controllerPath}/get`);
|
||||
const registrar = require(`${controllerPath}/registrar`);
|
||||
|
||||
// POST
|
||||
app.post(`${route}/csv`, (req, res) => {
|
||||
return csv(req.body)
|
||||
.then((data) => {
|
||||
res.download(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
//PUT
|
||||
app.put(`${route}/registrar`, (req, res) => {
|
||||
return registrar(req.body)
|
||||
@@ -28,14 +39,4 @@ app.get(`${route}`, (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
app.get(`${route}/csv`, (req, res) => {
|
||||
return csv(req.query)
|
||||
.then((data) => {
|
||||
res.download(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
Reference in New Issue
Block a user