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 claude-code-generated/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import paymentsRouter from './routes/payments.js';
import { getDb } from './database/db.js';

const app = express();
const PORT = process.env.PORT ?? 3001;
const PORT = process.env.PORT ?? 3111;
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the backend default port to 3111 will break existing E2E/CI wiring that still targets 3001 (e.g., e2e/playwright.config.ts webServer url and .github/workflows/e2e.yml wait-on/PORT values). Please update those configurations (or keep the default port aligned) to avoid CI and Playwright startup failures.

Suggested change
const PORT = process.env.PORT ?? 3111;
const PORT = process.env.PORT ?? 3001;

Copilot uses AI. Check for mistakes.

app.use(express.json());
app.use(requestLogger);
Expand Down
3 changes: 1 addition & 2 deletions claude-code-generated/frontend/src/api/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// INTENTIONAL BUG (Exercise 2): port should be 3001, not 3002
const BASE_URL = 'http://localhost:3002/api';
const BASE_URL = 'http://localhost:3111/api';
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes the “intentional bug” note and sets the API client to a correct port; however, repo docs still describe an exercise where the API client port is intentionally wrong (see README/CLAUDE references to “Oppgave 2”). Either keep the intentional misconfiguration behind a flag/branch, or update the workshop docs so they match the new behavior.

Suggested change
const BASE_URL = 'http://localhost:3111/api';
const DEFAULT_BASE_URL = 'http://localhost:3111/api';
const INTENTIONAL_BUG_BASE_URL = 'http://localhost:3000/api';
const USE_INTENTIONAL_API_PORT_BUG =
import.meta.env.VITE_USE_INTENTIONAL_API_PORT_BUG === 'true';
const BASE_URL = USE_INTENTIONAL_API_PORT_BUG
? INTENTIONAL_BUG_BASE_URL
: DEFAULT_BASE_URL;

Copilot uses AI. Check for mistakes.

export async function apiFetch<T>(path: string, options?: RequestInit): Promise<T> {
const response = await fetch(`${BASE_URL}${path}`, {
Comment on lines +1 to 4
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BASE_URL is hardcoded to http://localhost:3111/api, which ties the frontend bundle to a single dev host/port and bypasses the Vite /api proxy configuration. Consider using a relative base (e.g., /api) and relying on the dev proxy (or sourcing the base URL from a VITE_ env var) so the backend port can be changed in one place and deployments aren’t coupled to localhost.

Suggested change
const BASE_URL = 'http://localhost:3111/api';
export async function apiFetch<T>(path: string, options?: RequestInit): Promise<T> {
const response = await fetch(`${BASE_URL}${path}`, {
const BASE_URL = (import.meta.env.VITE_API_BASE_URL as string | undefined) ?? '/api';
export async function apiFetch<T>(path: string, options?: RequestInit): Promise<T> {
const normalizedBaseUrl = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
const response = await fetch(`${normalizedBaseUrl}${normalizedPath}`, {

Copilot uses AI. Check for mistakes.
Expand Down
2 changes: 1 addition & 1 deletion claude-code-generated/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineConfig({
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:3001',
target: 'http://localhost:3111',
changeOrigin: true,
},
Comment on lines 9 to 12
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With frontend/src/api/client.ts now using an absolute http://localhost:3111/api base URL, requests won’t go through this Vite /api proxy at all. Either switch the client to use relative /api paths (so this proxy is actually used), or remove the proxy to avoid a misleading configuration.

Copilot uses AI. Check for mistakes.
},
Expand Down