@luvio/network-adapter-composable
v0.156.4
Published
Composable adapter implementation of the Luvio NetworkAdapter
Downloads
366
Maintainers
Keywords
Readme
network-adapter-fetch
An implementation of the Luvio NetworkAdapter that allows for multiple NetworkAdapters in the same environment.
Install
npm i @luvio/network-adapter-composable
Usage
import { buildComposableNetworkAdapter } from '@luvio/network-adapter-composable';
import { composedJwtNetworkAdapter } from '@luvio/network-adapter-jwt';
import { fetchNetworkAdapter } from '@luvio/network-adapter-fetch';
const networkAdapter = buildComposableNetworkAdapter([
composedJwtNetworkAdapter, // Ex: handle ResourceRequests that needs JWT authentication, leveraging on the baseUri
{
shouldHandleRequest: () => true, // default network adapter
adapter: fetchNetworkAdapter,
},
]);
const luvio = new Luvio(new Environment(new InMemoryStore(), networkAdapter));