Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Dec 18, 2023
1 parent 0b738e6 commit e2a5998
Show file tree
Hide file tree
Showing 7 changed files with 855 additions and 760 deletions.
16 changes: 8 additions & 8 deletions apps/demo/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import express from 'express';
import bootstrap from './src/main.server';

function run(): void {
const port = process.env[`PORT`] || 4000;
const port = process.env['PORT'] || 4000;

// Start up the Node server
const server = app();
Expand All @@ -27,26 +27,26 @@ run();
export function app(): express.Express {
const server = express();
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, `../browser`);
const indexHtml = join(serverDistFolder, `index.server.html`);
const browserDistFolder = resolve(serverDistFolder, '../browser');
const indexHtml = join(serverDistFolder, 'index.server.html');

const commonEngine = new CommonEngine();

server.set(`view engine`, `html`);
server.set(`views`, browserDistFolder);
server.set('view engine', 'html');
server.set('views', browserDistFolder);

// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get(
`*.*`,
'*.*',
express.static(browserDistFolder, {
maxAge: `1y`,
maxAge: '1y',
}),
);

// 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 Down
16 changes: 10 additions & 6 deletions apps/demo/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import {ApplicationConfig, importProvidersFrom, Sanitizer} from '@angular/core';
import {ApplicationConfig, importProvidersFrom} from '@angular/core';
import {provideClientHydration} from '@angular/platform-browser';
import {provideAnimations} from '@angular/platform-browser/animations';
import {provideRouter} from '@angular/router';
import {TuiDialogModule, TuiRootModule} from '@taiga-ui/core';
import {TUI_SANITIZER, TuiDialogModule, TuiRootModule} from '@taiga-ui/core';
import {TuiPushModule} from '@taiga-ui/kit';
import {NgDompurifySanitizer} from '@tinkoff/ng-dompurify';

import {routes} from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [
provideAnimations(),
provideRouter(routes),
provideRouter([
{
path: '',
pathMatch: 'full',
loadComponent: async () => import('./home/home.component'),
},
]),
provideClientHydration(),
importProvidersFrom(TuiRootModule, TuiDialogModule, TuiPushModule),
{
provide: Sanitizer,
provide: TUI_SANITIZER,
useClass: NgDompurifySanitizer,
},
],
Expand Down
10 changes: 0 additions & 10 deletions apps/demo/src/app/app.routes.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/demo/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {NgDompurifyModule, NgDompurifySanitizer} from '@tinkoff/ng-dompurify';
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HomeComponent {
export default class HomeComponent {
private readonly dompurifySanitizer = inject(NgDompurifySanitizer);
private readonly dialogs = inject(TuiDialogService);
private readonly cd = inject(ChangeDetectorRef);
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Preview components</title>
<base href="/" />
<base href="./" />
<meta
content="Preview components landing"
name="description"
Expand Down
Loading

0 comments on commit e2a5998

Please sign in to comment.