Remove redis and add healthcheck endpoint
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const mongoose = require('mongoose')
|
||||
const redisClient = require('./redis')
|
||||
const port = process.env.PORT || 3000
|
||||
const env = process.env.NODE_ENV || 'development'
|
||||
module.exports = (app) => {
|
||||
@@ -20,12 +19,8 @@ module.exports = (app) => {
|
||||
// Create a document to force MongoDB to actually create the DB and collection
|
||||
await MyModel.create({ name: 'test' })
|
||||
|
||||
redisClient.connect().then((r) => {
|
||||
console.log('Redis connection Established')
|
||||
|
||||
app.listen(port, function () {
|
||||
console.log('Server Started On Port ' + port)
|
||||
})
|
||||
app.listen(port, function () {
|
||||
console.log('Server Started On Port ' + port)
|
||||
})
|
||||
})
|
||||
.catch(function (err) {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
const redis = require('redis')
|
||||
const env = process.env.NODE_ENV || 'development'
|
||||
|
||||
let connectionString
|
||||
if (env === 'development') {
|
||||
connectionString = process.env.REDIS_URL
|
||||
} else if (env === 'test') {
|
||||
connectionString = process.env.TEST_REDIS_URL
|
||||
} else if (env === 'production') {
|
||||
connectionString = process.env.REDIS_URL
|
||||
}
|
||||
const client = redis.createClient({ url: connectionString })
|
||||
|
||||
client.on('error', function (err) {
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
module.exports = client
|
||||
Reference in New Issue
Block a user