diff --git a/server.ts b/server.ts index cb8d7710e9b5fef8fc062f9884b59725335f3c05..ecb4ba746720df431a987faf87c5ae847e75ef79 100644 --- a/server.ts +++ b/server.ts @@ -2,7 +2,7 @@ import 'zone.js/node'; import { APP_BASE_HREF } from '@angular/common'; import { CommonEngine } from '@angular/ssr'; -import * as express from 'express'; +import express from 'express'; import { existsSync } from 'node:fs'; import { join } from 'node:path'; import AppServerModule from './src/main.server'; @@ -23,9 +23,12 @@ export function app(): express.Express { // Example Express Rest API endpoints // server.get('/api/**', (req, res) => { }); // Serve static files from /browser - server.get('*.*', express.static(distFolder, { - maxAge: '1y' - })); + server.get( + '*.*', + express.static(distFolder, { + maxAge: '1y', + }), + ); // All regular routes use the Angular engine server.get('*', (req, res, next) => { @@ -61,7 +64,7 @@ function run(): void { // The below code is to ensure that the server is run only when not requiring the bundle. declare const __non_webpack_require__: NodeRequire; const mainModule = __non_webpack_require__.main; -const moduleFilename = mainModule && mainModule.filename || ''; +const moduleFilename = (mainModule && mainModule.filename) || ''; if (moduleFilename === __filename || moduleFilename.includes('iisnode')) { run(); }