Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix #40

Merged
merged 1 commit into from
Aug 31, 2024
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
15 changes: 2 additions & 13 deletions apps/client/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { existsSync } from 'node:fs';
import { join } from 'node:path';
import bootstrap from './src/main.server';

// The Express app is exported so that it can be used by serverless Functions.

export function app(): express.Express {
const server = express();
const distFolder = join(process.cwd(), 'dist/apps/client/browser');
Expand All @@ -20,17 +20,6 @@ export function app(): express.Express {
server.set('view engine', 'html');
server.set('views', distFolder);

// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get(
'*.*',
express.static(distFolder, {
maxAge: '1y',
})
);

// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
console.log(`SSR request: ${protocol}://${headers.host}${originalUrl}`);
Expand All @@ -44,7 +33,7 @@ export function app(): express.Express {
publicPath: distFolder,
providers: [
{ provide: APP_BASE_HREF, useValue: baseUrl },
{ provide: 'API_URL', useValue: process.env.API_URL }
{ provide: 'API_URL', useValue: process.env['API_URL'] + '/api/v1' },
],
})
.then((html) => res.send(html))
Expand Down
4 changes: 3 additions & 1 deletion apps/client/src/app/shared/api-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { environment } from '../../environments/environment';
export class ApiClientService {
private baseUrl = environment.apiUrl;

constructor(private http: HttpClient, private tokenService: TokenService) {}
constructor(private http: HttpClient, private tokenService: TokenService) {

}

private getHeaders(): HttpHeaders {
const token = this.tokenService.getToken();
Expand Down
Loading