Files
message-inbox-web-frontend-sdk/apps/web/lib/backend/index.ts
T
2026-07-17 21:48:37 +05:30

16 lines
592 B
TypeScript

import type { Backend } from "./Backend";
import { mockBackend } from "./mock";
import { iiosBackend } from "./iios";
/**
* Choose the BFF backend from env. Default "mock" (in-memory store). Set
* BFF_BACKEND=iios (+ IIOS_URL etc.) to proxy the real IIOS service.
* Importing the IIOS backend runs no network calls until a method is invoked
* (the token is minted lazily), so the mock demo never needs IIOS present.
*/
export function getBackend(): Backend {
return (process.env.BFF_BACKEND ?? "mock").toLowerCase() === "iios" ? iiosBackend : mockBackend;
}
export type { Backend };