@xbim/flex-webkit
v2.20240913.1
Published
Angular library encapsulating OAuth2, data-access and NGXS state-management sevices for the Flex API
Downloads
11
Readme
xbim Flex Webkit
Flex Webkit provides an Angular 'core' module enabling a Flex application to be easily built and bootstrapped so you can get on with developing the 'interesting' functionality.
It provides the following features:
- OAuth2 authentication and Angular Route Guards for Authentication and Tenant authorization
- State-Management using NGXS, supporting OData querying and CRUD mechanisms
- Logging using ngx-logger
- Simple boot-strapping
Getting started
A typical app.module.ts will look something like
import { environment } from '../environments/environment';
const routes: Routes = [
{
path: 'yourAuthenticatedPage',
canActivate: [AuthGuard],
component: SomeComponent,
},
{
path: ':tenantId/yourApplication',
canActivate: [AuthGuard, TenantGuard], // Ensure user is logged in and has access to tenant
loadChildren: () =>
import('./lazyModule/yourapp.module').then((m) => m.YourAppModule), // Lazy loaded module
pathMatch: 'full',
},
/* Other routes */
];
@NgModule({
declarations: [
// Your components
],
imports: [
NgxsRouterPluginModule.forRoot(),
NgxsReduxDevtoolsPluginModule.forRoot({ name: environment.appName }),
LoggerModule.forRoot({
level: environment.production
? NgxLoggerLevel.INFO
: NgxLoggerLevel.DEBUG,
enableSourceMaps: true,
}),
BrowserModule,
BrowserAnimationsModule,
RouterModule.forRoot(routes),
FlexWebkitModule.forRoot(environment),
HttpClientModule,
// any other modules
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
State Management
TBC