Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineConfig({
proxy: {
// Forward all /api requests to the backend server
'/api': {
target: 'http://localhost:5000',
target: 'http://127.0.0.1:5000',
changeOrigin: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion server/config/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const mongoose = require('mongoose')

const connectDB = async () => {
try {
const conn = await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/stackit', {
const conn = await mongoose.connect(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/stackit', {
useNewUrlParser: true,
useUnifiedTopology: true,
})
Expand Down
8 changes: 4 additions & 4 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ if (!process.env.JWT_SECRET) {
process.env.PORT = process.env.PORT || '5000';
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
process.env.MONGODB_URI =
process.env.MONGODB_URI || 'mongodb://localhost:27017/stackit';
process.env.CLIENT_URL = process.env.CLIENT_URL || 'http://localhost:3000';
process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/stackit';
process.env.CLIENT_URL = process.env.CLIENT_URL || 'http://127.0.0.1:3000';
}

console.log('✅ JWT_SECRET loaded:', !!process.env.JWT_SECRET);
Expand All @@ -45,7 +45,7 @@ const server = createServer(app);
// Socket.io setup
const io = new Server(server, {
cors: {
origin: process.env.CLIENT_URL || 'http://localhost:3000',
origin: process.env.CLIENT_URL || 'http://127.0.0.1:3000',
methods: ['GET', 'POST'],
},
});
Expand Down Expand Up @@ -92,7 +92,7 @@ if (shouldEnableRateLimit()) {
app.use(helmet());
app.use(
cors({
origin: process.env.CLIENT_URL || 'http://localhost:3000',
origin: process.env.CLIENT_URL || 'http://127.0.0.1:3000',
credentials: true,
}),
);
Expand Down
2 changes: 1 addition & 1 deletion tests/critical-flows.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Critical User Flows', () => {

beforeAll(async () => {
// Connect to test database
await mongoose.connect(process.env.MONGODB_URI_TEST || 'mongodb://localhost:27017/stackit-test')
await mongoose.connect(process.env.MONGODB_URI_TEST || 'mongodb://127.0.0.1:27017/stackit-test')
})

afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/setup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest setup file
process.env.NODE_ENV = 'test'
process.env.MONGODB_URI_TEST = 'mongodb://localhost:27017/stackit-test'
process.env.MONGODB_URI_TEST = 'mongodb://127.0.0.1:27017/stackit-test'
process.env.JWT_SECRET = 'test-secret-key'

// Increase timeout for all tests
Expand Down