Drivers
In-memory web API
The in-memory driver is for rapid development without the need to set up a magento/shopify/etc backend. It will mock out the submission of a newsletter subscription and operate like a functional database.
To set up in the root component:
- Import
DaffNewsletterInMemoryDriverModule
from@daffodil/newsletter/testing
- Import
HttpClientInMemoryWebApiModule
fromangular-in-memory-web-api
- Include
DaffContactInMemoryDriverModule.forRoot()
andHttpClientInMemoryWebApiModule
in the imports section.
import { HttpClientInMemoryWebApiModule } from "angular-in-memory-web-api";
import { DaffNewsletterInMemoryDriverModule } from '@daffodil/newsletter/testing';
@NgModule({
imports: [
DaffNewsletterInMemoryDriverModule.forRoot(),
HttpClientInMemoryWebApiModule.forRoot()
]
})
export class AppModule {}
Now your @daffodil/newsletter
implementation will have access to the in-memory driver to use while developing.
Note: It is important to only have one driver set up at a time in the root component. To set up a driver configuration to make switching between different backend drivers simple, follow the advanced setup guide.