| 19 | } |
| 20 | |
| 21 | async function startServer () { |
| 22 | redisClient = new Redis({ |
| 23 | port: 6379, // Redis port |
| 24 | host: '127.0.0.1' // Redis host |
| 25 | }) |
| 26 | |
| 27 | // OR |
| 28 | // redisClient = new Redis.Cluster(/* options */); |
| 29 | |
| 30 | redisClient.on('connect', () => console.log('redis connected')) |
| 31 | |
| 32 | terminus(http.createServer(app), { |
| 33 | logger: console.log, |
| 34 | signal: 'SIGINT', |
| 35 | healthChecks: { |
| 36 | '/healthcheck': onHealthCheck |
| 37 | }, |
| 38 | onSignal |
| 39 | }).listen(3000) |
| 40 | } |
| 41 | |
| 42 | startServer().catch(err => console.error('connection error', err.stack)) |