Skip to content

Latest commit

 

History

History
103 lines (77 loc) · 2.55 KB

File metadata and controls

103 lines (77 loc) · 2.55 KB

Network Setup for Mobile Access

Your IP Address: 192.168.170.146

To make the QR code verification work on your phone, you need to configure the system to use your laptop's IP address instead of localhost.

Backend Configuration

1. Create backend/.env file:

# Server Configuration
PORT=5000
NODE_ENV=development

# MongoDB Configuration
MONGODB_URI=mongodb://localhost:27017/college-events

# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRE=7d

# CORS Configuration
FRONTEND_URL=http://192.168.170.146:5173
ADMIN_URL=http://192.168.170.146:5174

2. Update Vite Configuration

Create or update frontend/vite.config.js:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  server: {
    host: '0.0.0.0', // Allow external connections
    port: 5173
  }
})

Frontend Configuration

1. Create frontend/.env file:

VITE_API_URL=http://192.168.170.146:5000/api

How to Start the Servers

1. Start Backend:

cd backend
npm run dev

Backend will run on: http://192.168.170.146:5000

2. Start Frontend:

cd frontend
npm run dev

Frontend will run on: http://192.168.170.146:5173

Testing the QR Code

  1. Register for an event on your laptop
  2. Get the QR code from My Registrations page
  3. Scan QR code with phone - it should redirect to: http://192.168.170.146:5173/verify-registration?eventId=...&userId=...
  4. Phone will show the verification page with user details

Troubleshooting

If QR code doesn't work on phone:

  1. Check Network: Ensure phone and laptop are on same WiFi
  2. Check Firewall: Windows Firewall might block connections
  3. Check Ports: Ensure ports 5000 and 5173 are open
  4. Test URL: Try opening http://192.168.170.146:5173 on phone browser

Windows Firewall Settings:

  1. Open Windows Defender Firewall
  2. Click "Allow an app or feature through Windows Defender Firewall"
  3. Add Node.js and allow it for both Private and Public networks
  4. Or temporarily disable firewall for testing

Alternative IP Addresses:

If 192.168.170.146 doesn't work, try:

  • 192.168.1.x (common home network range)
  • 10.0.0.x (some router configurations)
  • Check your actual IP with ipconfig command

QR Code URL Format

The QR code will contain URLs like:

http://192.168.170.146:5173/verify-registration?eventId=123&userId=456

This allows anyone on the same network to scan and verify registrations without needing to log in.