@owlmeans/api-config-client
v0.1.7
Published
Client-side middleware that fetches server config from `GET /assets/config.json` and merges it into the client context.
Downloads
30
Readme
@owlmeans/api-config-client
Client-side middleware that fetches server config from GET /assets/config.json and merges it into the client context.
Overview
apiConfigMiddleware— context middleware that calls the config endpoint on startup- Elevates
@owlmeans/api-configmodules into the client module system - Merges the server
ApiConfiginto the client'sCommonConfigat initialization time
Installation
bun add @owlmeans/api-config-clientUsage
Register the middleware in your client context setup:
import { apiConfigMiddleware } from '@owlmeans/api-config-client'
context.registerMiddleware(apiConfigMiddleware)On initialization, the middleware calls the API_CONFIG module and merges the response into the context config.
API
apiConfigMiddleware: Middleware
A context initialization middleware. Calls API_CONFIG module, receives ApiConfig, and applies it to the context via mergeConfig.
Related Packages
@owlmeans/api-config—API_CONFIGalias andApiConfigtype@owlmeans/api-config-server— server that serves the config endpoint
