update
This commit is contained in:
parent
91bcf3c2ed
commit
33ea71dc12
|
|
@ -1,7 +1,8 @@
|
||||||
import { RenderMode, ServerRoute } from '@angular/ssr';
|
import { RenderMode, ServerRoute } from '@angular/ssr';
|
||||||
|
|
||||||
export const serverRoutes: ServerRoute[] = [
|
export const serverRoutes: ServerRoute[] = [
|
||||||
{ path: 'home', renderMode: RenderMode.Prerender },
|
// WICHTIG: home auf Server stellen!
|
||||||
|
{ path: 'home', renderMode: RenderMode.Server },
|
||||||
{ path: 'terms-of-use', renderMode: RenderMode.Prerender },
|
{ path: 'terms-of-use', renderMode: RenderMode.Prerender },
|
||||||
{ path: 'privacy-statement', renderMode: RenderMode.Prerender },
|
{ path: 'privacy-statement', renderMode: RenderMode.Prerender },
|
||||||
{ path: '**', renderMode: RenderMode.Server }
|
{ path: '**', renderMode: RenderMode.Server }
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,20 @@
|
||||||
// SSR-safe: check if window exists
|
// SSR-safe: check if window exists
|
||||||
// Im Browser nehmen wir den aktuellen Host (z.B. localhost).
|
// Im Browser nehmen wir den aktuellen Host (z.B. localhost).
|
||||||
// Auf dem Server (SSR in Docker) nehmen wir 'bizmatch-app' (der Name des Backend-Containers).
|
// Auf dem Server (SSR in Docker) nehmen wir 'bizmatch-app' (der Name des Backend-Containers).
|
||||||
const hostname = typeof window !== 'undefined' ? window.location.hostname : 'bizmatch-app';
|
const isBrowser = typeof window !== 'undefined' && window.navigator.userAgent !== 'node';
|
||||||
const isBrowser = typeof window !== 'undefined';
|
const hostname = isBrowser ? window.location.hostname : 'bizmatch-app';
|
||||||
|
|
||||||
// WICHTIG: Port anpassen!
|
// WICHTIG: Port anpassen!
|
||||||
// Lokal läuft das Backend auf 3001. Im Docker Container auch auf 3001.
|
// Lokal läuft das Backend auf 3001. Im Docker Container auch auf 3001.
|
||||||
// Deine alte Config hatte hier :4200 stehen, das war falsch (das ist das Frontend).
|
// Deine alte Config hatte hier :4200 stehen, das war falsch (das ist das Frontend).
|
||||||
const port = 3001;
|
|
||||||
const protocol = typeof window !== 'undefined' ? 'http' : 'http'; // Intern im Docker meist http
|
|
||||||
export const environment_base = {
|
export const environment_base = {
|
||||||
// apiBaseUrl: 'http://localhost:3000',
|
// apiBaseUrl: 'http://localhost:3000',
|
||||||
// GETTER FUNCTION für die API URL (besser als statischer String für diesen Fall)
|
// GETTER FUNCTION für die API URL (besser als statischer String für diesen Fall)
|
||||||
get apiBaseUrl() {
|
get apiBaseUrl() {
|
||||||
if (isBrowser) {
|
if (isBrowser) {
|
||||||
// Browser: Nutze die öffentliche HTTPS API
|
|
||||||
return 'https://api.bizmatch.net';
|
return 'https://api.bizmatch.net';
|
||||||
} else {
|
} else {
|
||||||
// SSR (Docker): Nutze die interne HTTP Verbindung direkt zum Backend
|
// SSR (Docker) nutzt interne Verbindung
|
||||||
// WICHTIG: http (nicht https) und Port 3001
|
|
||||||
return 'http://bizmatch-app:3001';
|
return 'http://bizmatch-app:3001';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue