# Localhost Not Working - Quick Fix (Windows)

If localhost stops working after switching between PROD and DEV, run:

```powershell
.\fix_localhost_dev.ps1
```

Then open:

- http://localhost:5000

## Important

- Use **port 5000** in DEV (`http://localhost:5000`), not `http://localhost`.
- `http://localhost` (without port) usually goes to port 80 and can show unrelated 404 pages.

## If still not working

Run these checks:

```powershell
Get-NetTCPConnection -LocalPort 5000 -ErrorAction SilentlyContinue
Invoke-WebRequest -Uri http://localhost:5000 -UseBasicParsing
```

Expected:

- Port 5000 in `Listen` state
- HTTP status `200` (or redirect to login flow)

## Why this happens

- PowerShell keeps env vars in the current session.
- If `APP_ENV=production` remains set, app may run with production behavior/ports and localhost flow looks broken.
- `fix_localhost_dev.ps1` resets env vars and starts clean DEV mode.
