Skip to content
Merged
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
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
VITE_API_BASE_URL=http://localhost/NesterApp/backend/api
DB_HOST=localhost
DB_NAME=nester_db
DB_USER=root
Expand Down
5 changes: 1 addition & 4 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
```bash
npm install
```
- Stelle sicher, dass deine `.env` die korrekte API-URL enthält:
```env
VITE_API_BASE_URL=http://localhost/NesterApp/backend/api
```
- Die API-URL wird automatisch anhand des Servernamens ermittelt – keine manuelle Konfiguration nötig.
- Starte den Entwicklungsserver:
```bash
npm run dev
Expand Down
8 changes: 6 additions & 2 deletions src/services/nestService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// We will default to a common path structure, e.g. http://localhost/Taubennester/backend/api
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost/Taubennester/backend/api';
// Dynamically resolve the API base URL from the current server's origin.
// This ensures the app works on any server without build-time configuration.
export const API_BASE_URL = (() => {
const { protocol, host } = window.location;
return `${protocol}//${host}/backend/api`;
})();

// Helper to build headers with token
const getHeaders = (token) => {
Expand Down
Loading