Remove redis and add healthcheck endpoint

This commit is contained in:
2026-08-17 22:50:49 +03:30
parent 1618eae69f
commit 86655f2b69
10 changed files with 66 additions and 146 deletions
+2 -7
View File
@@ -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) {
-18
View File
@@ -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