diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 6527df61..88b84c8f 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -6,8 +6,8 @@ const promBundle = require('express-prom-bundle'); const app = express(); const port = 8000; -const authServiceUrl = process.env.AUTH_SERVICE_URL ; -const userServiceUrl = process.env.USER_SERVICE_URL ; +const authServiceUrl = process.env.AUTH_SERVICE_URL || 'http://localhost:8002'; +const userServiceUrl = process.env.USER_SERVICE_URL || 'http://localhost:8001'; app.use(cors()); app.use(express.json()); diff --git a/users/authservice/auth-service.js b/users/authservice/auth-service.js index cefbdf8e..9764f088 100644 --- a/users/authservice/auth-service.js +++ b/users/authservice/auth-service.js @@ -11,7 +11,7 @@ const port = 8002; app.use(express.json()); // Connect to MongoDB -const mongoUri = process.env.MONGODB_URI; +const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/userdb'; mongoose.connect(mongoUri); // Function to validate required fields in the request body diff --git a/users/userservice/user-service.js b/users/userservice/user-service.js index b5cd7cb1..be958427 100644 --- a/users/userservice/user-service.js +++ b/users/userservice/user-service.js @@ -12,7 +12,7 @@ const port = 8001; app.use(bodyParser.json()); // Connect to MongoDB -const mongoUri = process.env.MONGODB_URI; +const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/userdb'; mongoose.connect(mongoUri);