|
14 | 14 | * from your application's main.server.ts file, as seen below with the |
15 | 15 | * import for `ngExpressEngine`. |
16 | 16 | */ |
| 17 | + |
| 18 | +/* eslint-disable import/no-namespace, @typescript-eslint/no-require-imports */ |
| 19 | + |
17 | 20 | import 'reflect-metadata'; |
18 | 21 | import 'zone.js/node'; |
19 | 22 |
|
20 | | -/* eslint-disable import/no-namespace */ |
21 | | -import * as morgan from 'morgan'; |
22 | | -import express from 'express'; |
23 | | -import * as ejs from 'ejs'; |
| 23 | +import { readFileSync } from 'node:fs'; |
| 24 | +import { createServer } from 'node:https'; |
| 25 | +import { join } from 'node:path'; |
| 26 | + |
| 27 | +import { APP_BASE_HREF } from '@angular/common'; |
| 28 | +import { enableProdMode } from '@angular/core'; |
| 29 | +import { CommonEngine } from '@angular/ssr/node'; |
| 30 | +import { TOKENITEM } from '@dspace/core/auth/models/auth-token-info.model'; |
| 31 | +import { hasValue } from '@dspace/shared/utils/empty.util'; |
| 32 | +import { json } from 'body-parser'; |
24 | 33 | import * as compression from 'compression'; |
| 34 | +import { renderFile } from 'ejs'; |
| 35 | +import express from 'express'; |
25 | 36 | import expressStaticGzip from 'express-static-gzip'; |
26 | | -import { LRUCache } from 'lru-cache'; |
| 37 | +import { createProxyMiddleware } from 'http-proxy-middleware'; |
| 38 | +import { createHttpTerminator } from 'http-terminator'; |
27 | 39 | import { isbot } from 'isbot'; |
| 40 | +import { LRUCache } from 'lru-cache'; |
| 41 | +import * as morgan from 'morgan'; |
28 | 42 | import { createCertificate } from 'pem'; |
29 | | -import { createServer } from 'https'; |
30 | | -import { json } from 'body-parser'; |
31 | | -import { createHttpTerminator } from 'http-terminator'; |
32 | | - |
33 | | -import { readFileSync } from 'fs'; |
34 | | -import { join } from 'path'; |
35 | 43 |
|
36 | | -import { enableProdMode } from '@angular/core'; |
37 | | - |
38 | | - |
39 | | -import { environment } from './src/environments/environment'; |
40 | | -import { createProxyMiddleware } from 'http-proxy-middleware'; |
41 | | -import { hasValue } from '@dspace/shared/utils/empty.util'; |
42 | | -import { UIServerConfig } from './src/config/ui-server-config.interface'; |
43 | | -import bootstrap from './src/main.server'; |
44 | | -import { buildAppConfig } from './src/config/config.server'; |
45 | 44 | import { |
46 | 45 | APP_CONFIG, |
47 | 46 | AppConfig, |
48 | 47 | } from './src/config/app-config.interface'; |
| 48 | +import { buildAppConfig } from './src/config/config.server'; |
49 | 49 | import { extendEnvironmentWithAppConfig } from './src/config/config.util'; |
50 | | -import { logStartupMessage } from './startup-message'; |
51 | | -import { TOKENITEM } from '@dspace/core/auth/models/auth-token-info.model'; |
52 | | -import { CommonEngine } from '@angular/ssr/node'; |
53 | | -import { APP_BASE_HREF } from '@angular/common'; |
| 50 | +import { SsrExcludePatterns } from './src/config/ssr-config.interface'; |
| 51 | +import { UIServerConfig } from './src/config/ui-server-config.interface'; |
| 52 | +import { environment } from './src/environments/environment'; |
54 | 53 | import { |
55 | 54 | REQUEST, |
56 | 55 | RESPONSE, |
57 | 56 | } from './src/express.tokens'; |
58 | | -import { SsrExcludePatterns } from './src/config/ssr-config.interface'; |
| 57 | +import bootstrap from './src/main.server'; |
| 58 | +import { logStartupMessage } from './startup-message'; |
59 | 59 |
|
60 | 60 | /* |
61 | 61 | * Set path for the browser application's dist folder |
@@ -130,7 +130,7 @@ export function app() { |
130 | 130 | */ |
131 | 131 | server.use(json()); |
132 | 132 |
|
133 | | - server.engine('ejs', ejs.renderFile); |
| 133 | + server.engine('ejs', renderFile); |
134 | 134 |
|
135 | 135 | /* |
136 | 136 | * Register the view engines for html and ejs |
@@ -316,7 +316,7 @@ function clientSideRender(req, res) { |
316 | 316 | // Replace base href dynamically |
317 | 317 | html = html.replace( |
318 | 318 | /<base href="[^"]*">/, |
319 | | - `<base href="${namespace.endsWith('/') ? namespace : namespace + '/'}">` |
| 319 | + `<base href="${namespace.endsWith('/') ? namespace : namespace + '/'}">`, |
320 | 320 | ); |
321 | 321 |
|
322 | 322 | // Replace REST URL with UI URL |
@@ -650,10 +650,10 @@ function start() { |
650 | 650 | */ |
651 | 651 | function isExcludedFromSsr(path: string, excludePathPattern: SsrExcludePatterns[]): boolean { |
652 | 652 | const patterns = excludePathPattern.map(p => |
653 | | - new RegExp(p.pattern, p.flag || '') |
| 653 | + new RegExp(p.pattern, p.flag || ''), |
654 | 654 | ); |
655 | 655 | return patterns.some((regex) => { |
656 | | - return regex.test(path) |
| 656 | + return regex.test(path); |
657 | 657 | }); |
658 | 658 | } |
659 | 659 |
|
|
0 commit comments