-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (26 loc) · 908 Bytes
/
Copy pathserver.js
File metadata and controls
29 lines (26 loc) · 908 Bytes
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
const app = require('./src/app')
const PORT = process.env.PORT || 3000
// Configuración del servidor
const server = app.listen(PORT, () => {
console.log(`🚀 Servidor corriendo en http://localhost:${PORT}`)
console.log(`📊 Endpoints disponibles:`)
console.log(` - GET http://localhost:${PORT}/`)
console.log(` - GET http://localhost:${PORT}/api/bcv/health`)
console.log(` - GET http://localhost:${PORT}/api/bcv/dollar`)
console.log(` - GET http://localhost:${PORT}/api/bcv/rates`)
})
// Manejo de cierre graceful
process.on('SIGTERM', () => {
console.log('🛑 Recibida señal SIGTERM, cerrando servidor...')
server.close(() => {
console.log('Servidor cerrado')
process.exit(0)
})
})
process.on('SIGINT', () => {
console.log('🛑 Recibida señal SIGINT, cerrando servidor...')
server.close(() => {
console.log('Servidor cerrado')
process.exit(0)
})
})