24 lines
601 B
JavaScript
24 lines
601 B
JavaScript
require('dotenv').config();
|
|
const app = require('./src/app');
|
|
const redis = require('./src/config/redis');
|
|
const { registrarGpsJob } = require('./src/jobs/gps.job');
|
|
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
async function iniciar() {
|
|
// Conectar Redis
|
|
await redis.connect();
|
|
|
|
// Levantar servidor Express
|
|
app.listen(PORT, () => {
|
|
console.log(`🚀 Servidor corriendo en http://localhost:${PORT}`);
|
|
});
|
|
|
|
// Registrar Cron Job del simulador GPS
|
|
registrarGpsJob();
|
|
}
|
|
|
|
iniciar().catch((err) => {
|
|
console.error('❌ Error al iniciar el servidor:', err.message);
|
|
process.exit(1);
|
|
}); |