@owlmeans/api-config
v0.1.7
Published
Shared module for advertising safe config values from server to client via a REST endpoint.
Readme
@owlmeans/api-config
Shared module for advertising safe config values from server to client via a REST endpoint.
Overview
- Exposes a
GET /assets/config.jsonmodule that returns non-sensitive config fields ApiConfig— the advertised config type (subset ofCommonConfig)API_CONFIG— module alias for the config endpointnotAdvertizedConfigKeys/allowedConfigRecords— lists controlling what is/isn't exposed
Installation
bun add @owlmeans/api-configUsage
Use with server and client counterparts — this package provides the shared types and module alias:
import { API_CONFIG } from '@owlmeans/api-config'
import type { ApiConfig } from '@owlmeans/api-config'API
ApiConfig
Subset of CommonConfig safe to expose to clients (no db credentials, secrets, etc.).
API_CONFIG
Module alias 'api-config:advertise' used to register/call the config endpoint.
modules
Array of route definitions for the config advertisement endpoint.
Related Packages
@owlmeans/api-config-server— server-side module that serves the config@owlmeans/api-config-client— client middleware that fetches and merges config
