-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
50 lines (37 loc) · 1.27 KB
/
server.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
//Ambiente de desarrollo. Environment.
if(process.env.NODE_ENV !== 'production') {
require('dotenv').config()
};
//Importamos los modulos necesarios
let express = require('express')
let app = express()
const path = require('path')
const csv = require('./js/b-dragon.js')
//Para leer archivos
let fs = require('fs')
const res = require('express/lib/response')
const csvData = require('./js/b-dragon.js')
const csvDataDragon = require('./js/b-dragon.js')
const csvDataAe = require('./js/b-ae.js')
//Definimos puerto escucha
let PORT = 3000
//Publicamos carpeta public completa para terner disponible
app.use(express.urlencoded({
extended: true
}));
app.use(express.json());
app.use(express.static(__dirname + '/public'));
app.use("/public/css/", express.static(__dirname + '/public/css/'));
app.use('/public/img/', express.static(__dirname + '/public/img/'));
app.use('/public/js/', express.static(__dirname + '/public/js/'));
//Rutas
app.get("/",(req,res) => {
res.sendFile(__dirname + '/public/html/index.html')
});
//Router
app.use("/", csvDataAe);
app.use("/", csvDataDragon);
//Ejecutamos server
//app.listen(PORT, () =>{`Server ejecutanto en http://localhost/${PORT}`});
app.listen(process.env.PORT || 3000);
console.log(`ejecutando por http://localhost:${PORT}`)