-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathindex.js
20 lines (20 loc) · 866 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* ---------------------------------------------------- */
/* Utilice este archivo como arranque del Back-End para utilizar
Todas las funcionalidades Proyecto*/
/* ---------------------------------------------------- */
'use strict'
const api = require('./app')
const chalk = require('chalk')
const scheduleCoin = require('./schedule/coin.schedule')
const SaveDataDB = require('./schedule/historic-coin.schedule')
const port = process.env.PORT || 3000
// Conexion con mongoDB
require('./config/mongo-db')()
.then(()=> SaveDataDB())
.catch((error) =>{throw new Error(error)})
// Conexion con redisDB
require('./config/redis-db').initRedisDB
.then((redisClient)=> scheduleCoin(redisClient))
.catch((error) =>{throw new Error(error)})
// Inicio del server
api.listen(port, () => console.log(`${chalk.green('[btven-api-v2]')} server listening on port ${port}`))