-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex-eco.js
58 lines (45 loc) · 1.42 KB
/
index-eco.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"use strict";
require("dotenv").config();
const express = require("express");
const {readRegistros,readJoinCruzado,ultimaVistaRec} = require("./db/registrosGateways");
const {getElementSpecific,getElementAutomatic,getCsvData} = require("./mock/mock-script");
{
};
const app = express();
// app.use(express.json());
app.use(express.static("public"));
app.get("/registros/read-all",(rq,rs)=>{
readRegistros()
.then((res)=>{
rs.send(res);
// console.table(res);
});
console.log("sending :: lectura total de registros...");
});
app.get("/joins/reg-hyd-rec-bod",(rq,rs)=>{
readJoinCruzado()
.then((res)=>{
rs.send(res);
// console.table(res);
});
console.log("sending :: registros cruzados con nombre...");
});
app.get("/joins/ultima-vista",(rq,rs)=>{
ultimaVistaRec()
.then((res)=>{
rs.send(res);
// console.table(res);
});
console.log("sending :: ultima vista de cada tag...");
});
app.get("/mock-api/casabe/:index", async (req,res)=>{
const index = parseInt(req.params.index);
getCsvData()
.then((array)=>{
res.send(array[index]);
console.log(`sending... BodegaID: ${array[index].BodegaID}, tagsArraySize: ${array[index].tagsArray.length}`);
})
});
app.listen(process.env.PORT || 3000,()=>{
console.log("Set up :: Servidor escuhcando en PORT ",process.env.PORT);
});