Skip to content

Commit

Permalink
Fix SSR API base url
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Sep 19, 2023
1 parent 63bbd0a commit d702f19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function run(): void {
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
console.log(`API Base URL will be https://${process.env["HOST"]}/api/v3`)
});
}

Expand Down
11 changes: 10 additions & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { IEnvironment } from "./environment-interface";

let baseUrl: string;

if(typeof window !== 'undefined') {
baseUrl = window.location.protocol + '//' + window.location.host + "/api/v3";
} else {
// @ts-ignore
baseUrl = "https://" + process.env.HOST + "/api/v3";
}

export const environment: IEnvironment = {
production: true,
apiBaseUrl: window.location.protocol + '//' + window.location.host + "/api/v3"
apiBaseUrl: baseUrl,
};

0 comments on commit d702f19

Please sign in to comment.