2022-06-28 07:40:33 +00:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
import { BrowserModule } from '@angular/platform-browser';
|
|
|
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
|
import { ExtraOptions, PreloadAllModules, RouterModule } from '@angular/router';
|
2022-07-21 02:23:10 +00:00
|
|
|
import { MatIconRegistry, MatIconModule } from '@angular/material/icon';
|
|
|
|
import { DomSanitizer } from '@angular/platform-browser';
|
2022-06-28 07:40:33 +00:00
|
|
|
import { MarkdownModule } from 'ngx-markdown';
|
2022-08-01 05:33:57 +00:00
|
|
|
import * as nats from 'nats.ws';
|
|
|
|
|
2022-06-28 07:40:33 +00:00
|
|
|
import { FuseModule } from '@fuse';
|
|
|
|
import { FuseConfigModule } from '@fuse/services/config';
|
|
|
|
import { FuseMockApiModule } from '@fuse/lib/mock-api';
|
|
|
|
import { CoreModule } from 'app/core/core.module';
|
|
|
|
import { appConfig } from 'app/core/config/app.config';
|
|
|
|
import { mockApiServices } from 'app/mock-api';
|
|
|
|
import { LayoutModule } from 'app/layout/layout.module';
|
|
|
|
import { AppComponent } from 'app/app.component';
|
|
|
|
import { appRoutes } from 'app/app.routing';
|
2022-08-01 05:33:57 +00:00
|
|
|
import { NATS_CONNECTION } from 'app/core/nats/token';
|
|
|
|
import { MemberModule } from 'app/modules/polyglot/member/member.module';
|
2022-06-28 07:40:33 +00:00
|
|
|
|
|
|
|
const routerConfig: ExtraOptions = {
|
|
|
|
preloadingStrategy: PreloadAllModules,
|
|
|
|
scrollPositionRestoration: 'enabled',
|
|
|
|
};
|
|
|
|
|
2022-08-01 05:33:57 +00:00
|
|
|
const natsConnection = () => {
|
|
|
|
return new Promise<nats.NatsConnection>((resolve, reject) => {
|
|
|
|
nats
|
|
|
|
.connect({
|
|
|
|
servers: ['ws://192.168.50.200:8088'],
|
|
|
|
})
|
|
|
|
.then((conn) => {
|
|
|
|
console.log('NATS connected', conn.info);
|
|
|
|
resolve(conn);
|
|
|
|
})
|
|
|
|
.catch((e) => {
|
|
|
|
reject(e);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-06-28 07:40:33 +00:00
|
|
|
@NgModule({
|
|
|
|
declarations: [AppComponent],
|
|
|
|
imports: [
|
|
|
|
BrowserModule,
|
|
|
|
BrowserAnimationsModule,
|
|
|
|
RouterModule.forRoot(appRoutes, routerConfig),
|
|
|
|
|
|
|
|
// Fuse, FuseConfig & FuseMockAPI
|
|
|
|
FuseModule,
|
|
|
|
FuseConfigModule.forRoot(appConfig),
|
|
|
|
FuseMockApiModule.forRoot(mockApiServices),
|
|
|
|
|
|
|
|
// Core module of your application
|
|
|
|
CoreModule,
|
|
|
|
|
|
|
|
// Layout module of your application
|
|
|
|
LayoutModule,
|
|
|
|
|
|
|
|
// 3rd party modules that require global configuration via forRoot
|
|
|
|
MarkdownModule.forRoot({}),
|
2022-07-21 02:23:10 +00:00
|
|
|
MatIconModule,
|
2022-08-01 05:33:57 +00:00
|
|
|
|
|
|
|
MemberModule.forRoot(),
|
2022-06-28 07:40:33 +00:00
|
|
|
],
|
2022-08-01 05:33:57 +00:00
|
|
|
providers: [{ provide: NATS_CONNECTION, useFactory: natsConnection }],
|
2022-06-28 07:40:33 +00:00
|
|
|
bootstrap: [AppComponent],
|
|
|
|
})
|
2022-07-21 02:23:10 +00:00
|
|
|
export class AppModule {
|
|
|
|
constructor(matIconRegistry: MatIconRegistry, domSanitizer: DomSanitizer) {
|
|
|
|
matIconRegistry.addSvgIconSet(
|
|
|
|
domSanitizer.bypassSecurityTrustResourceUrl('./assets/mdi.svg')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|