Skip to content

Commit

Permalink
Merge pull request #39 from joematthews/fix/resolve-eslint-errors-in-…
Browse files Browse the repository at this point in the history
…server-and-main

fix(server.ts & main.ts): resolve eslint errors
  • Loading branch information
joematthews authored Mar 24, 2024
2 parents 266f32f + b771bc2 commit 78b4cea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export function app(): express.Express {
server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;

if (!headers.host)
throw new Error(
'cannot execute commonEngine.render: headers.host is undefined',
);

commonEngine
.render({
bootstrap,
Expand All @@ -40,7 +45,7 @@ export function app(): express.Express {
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
})
.then((html) => res.send(html))
.catch((err) => {
.catch((err: unknown) => {
next(err);
});
});
Expand All @@ -54,7 +59,9 @@ function run(): void {
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
console.log(
`Node Express server listening on http://localhost:${port.toString()}`,
);
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';

bootstrapApplication(AppComponent, appConfig).catch((err) => {
bootstrapApplication(AppComponent, appConfig).catch((err: unknown) => {
console.error(err);
});

0 comments on commit 78b4cea

Please sign in to comment.