Browse Source

tls authorization disabled for dev

feature/ssr-migration-schematic
erdemcaygor 1 year ago
parent
commit
2f15543056
  1. 16
      npm/ng-packs/apps/dev-app/src/server.ts

16
npm/ng-packs/apps/dev-app/src/server.ts

@ -1,3 +1,4 @@
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
import 'zone.js/node';
import { APP_BASE_HREF } from '@angular/common';
@ -23,9 +24,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) => {
@ -39,8 +43,8 @@ export function app(): express.Express {
publicPath: distFolder,
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => next(err));
.then(html => res.send(html))
.catch(err => next(err));
});
return server;
@ -61,7 +65,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();
}

Loading…
Cancel
Save