Skip to content

Create api.ts#1

Open
glazing-town wants to merge 1 commit intomainfrom
glazing-town-patch-1
Open

Create api.ts#1
glazing-town wants to merge 1 commit intomainfrom
glazing-town-patch-1

Conversation

@glazing-town
Copy link
Owner

What was changed

Introduced a centralized configuration module that reads the API base URL from an environment variable, with a safe default pointing to localhost.

Why it was changed

API URLs are often hardcoded across components, which makes environment changes (local, staging, production) harder and error-prone. Centralizing this configuration improves maintainability and avoids duplicated logic.

How to test

  1. Set the VITE_API_BASE_URL environment variable (or leave it unset).
  2. Import API_BASE_URL from the new configuration module.
  3. Verify it uses the environment value when provided, and falls back to http://localhost:3000 otherwise.

## What was changed
Introduced a centralized configuration module that reads the API base URL from an environment variable, with a safe default pointing to localhost.

## Why it was changed
API URLs are often hardcoded across components, which makes environment changes (local, staging, production) harder and error-prone. Centralizing this configuration improves maintainability and avoids duplicated logic.

## How to test
1. Set the `VITE_API_BASE_URL` environment variable (or leave it unset).
2. Import `API_BASE_URL` from the new configuration module.
3. Verify it uses the environment value when provided, and falls back to `http://localhost:3000` otherwise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant