Skip to content

Commit

Permalink
fix(frontend): NgxCookieService required provider (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft authored Jul 28, 2024
1 parent e09bee5 commit 133bca1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/frontend/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr';
import express from 'express';
import { REQUEST as SSR_REQUEST } from 'ngx-cookie-service-ssr';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';

Expand Down Expand Up @@ -29,7 +30,7 @@ export function app(): express.Express {
);

// All regular routes use the Angular engine
server.get('*', (req, res, next) => {
server.get('**', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;

commonEngine
Expand All @@ -42,6 +43,7 @@ export function app(): express.Express {
{ provide: APP_BASE_HREF, useValue: baseUrl },
{ provide: 'BASE_URL', useValue: `${protocol}://${headers.host}` },
// https://www.npmjs.com/package/ngx-cookie-service-ssr#server-side-rendering
{ provide: SSR_REQUEST, useValue: req },
{ provide: 'REQUEST', useValue: req },
{ provide: 'RESPONSE', useValue: res },
],
Expand Down

0 comments on commit 133bca1

Please sign in to comment.