Skip to content
qubeejs/angular
API/provideQubee

provideQubee

function@qubeejs/angularsrc/lib/provide-qubee.ts

Sets up providers necessary to enable Qubee functionality for the application.

provideQubee(config: QubeeConfig): EnvironmentProviders
Parameter Type Description
config QubeeConfig The driver definition, plus an optional base URL, pagination mode and request / response key overrides.

Returns — A set of providers to setup Qubee

Pass the driver definition exported by the core — STRAPI_DRIVER, LARAVEL_DRIVER, … — rather than an id. Importing one definition lets the other nineteen drivers tree-shake out of your bundle:

import { STRAPI_DRIVER, provideQubee } from '@qubeejs/angular';
bootstrapApplication(AppComponent, {
providers: [provideQubee({ driver: STRAPI_DRIVER })]
});

When the backend is only known at runtime, look the definition up in the registry — the cost of bundling every driver is then visible at your own import site:

import { DRIVERS, provideQubee } from '@qubeejs/angular';
provideQubee({ driver: DRIVERS[environment.driver] });

A base URL, request and response key overrides, and the PostgREST pagination mode are passed alongside the driver:

import { PaginationModeEnum, POSTGREST_DRIVER, provideQubee } from '@qubeejs/angular';
provideQubee({
baseUrl: 'https://api.example.com',
driver: POSTGREST_DRIVER,
pagination: PaginationModeEnum.RANGE,
response: { data: 'items' }
});