Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Commit 2e74169

Browse files
committed
feat: Update API base URL logic to support local development and production environments
1 parent cf78317 commit 2e74169

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

pages/api/[...slug].ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
7474
// Détection du host pour choisir l'API cible
7575
const host = req.headers.host || '';
7676
let apiBaseUrl: string;
77-
// if (host.includes('croissant-api.fr')) {
78-
// apiBaseUrl = 'http://localhost:3456';
79-
// } else {
80-
// apiBaseUrl = 'https://api.croissant-api.fr';
81-
// }
82-
apiBaseUrl = "https://api.croissant-api.fr";
77+
if (host.includes('croissant-api.fr')) {
78+
apiBaseUrl = 'http://localhost:3456';
79+
} else {
80+
apiBaseUrl = 'https://croissant-api.fr/api';
81+
}
82+
// apiBaseUrl = "https://api.croissant-api.fr";
8383

8484
let url = `${apiBaseUrl}/${Array.isArray(slug) ? slug.join('/') : slug}`;
8585

0 commit comments

Comments
 (0)