Skip to content

Commit

Permalink
feat(driver): add in-memory module
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 committed Oct 9, 2024
1 parent b3a5a1a commit d303e2a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions libs/driver/in-memory/src/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {
NgModule,
ModuleWithProviders,
importProvidersFrom,
} from '@angular/core';
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';

import { DaffInMemoryRootBackend } from './backend/public_api';
import {
DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT,
DaffInMemoryDriverConfig,
provideDaffInMemoryDriverConfig,
} from './config/public_api';

/**
* Sets up the angular in memory web API with the {@link DaffInMemoryRootBackend}.
*/
@NgModule()
export class DaffInMemoryDriverModule {
static forRoot(config: DaffInMemoryDriverConfig = DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT): ModuleWithProviders<DaffInMemoryDriverModule> {
return {
ngModule: DaffInMemoryDriverModule,
providers: [
importProvidersFrom(HttpClientInMemoryWebApiModule.forRoot(DaffInMemoryRootBackend, config)),
provideDaffInMemoryDriverConfig(config),
],
};
}
}
1 change: 1 addition & 0 deletions libs/driver/in-memory/src/public_api.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './backend/public_api';
export * from './driver/public_api';
export * from './config/public_api';
export * from './module';

0 comments on commit d303e2a

Please sign in to comment.