@owlmeans/server-context
v0.1.7
Published
Server-side context factory with file-based config, trusted keys, and Ed25519 guard pre-wired.
Readme
@owlmeans/server-context
Server-side context factory with file-based config, trusted keys, and Ed25519 guard pre-wired.
Overview
makeServerContext()creates a context with file config reader,PLUGINSresource, and trusted key management- Extends
BasicContextwithServerContextwhich includes API server and auth service append points - The
confighelper re-exported here configures aServerConfigwithport,security, etc. - Typically accessed through
@owlmeans/server-app'smakeContext, which calls this internally
Installation
bun add @owlmeans/server-contextUsage
Usually called indirectly through @owlmeans/server-app:
import { makeContext } from '@owlmeans/server-app'
const context = makeContext(appConfig)When building a custom server context:
import { makeServerContext, config } from '@owlmeans/server-context'
const serverContext = makeServerContext(
config(AppType.Backend, 'my-service', { port: 3000 })
)API
makeServerContext<C, T>(cfg): T
Creates a server context with:
- File-based config reader middleware (reads
CONFIG_DIR/config.json) PLUGINSconfig resource- Trusted key management resource
- Ed25519 guard service registration
config<C>(type, service, cfg?): C
Creates a ServerConfig. Alias re-exported from @owlmeans/server-app.
ServerConfig
Extends CommonConfig with port?: number, security?: ServerSecurityConfig.
ServerContext<C>
Extends BasicContext<C> with getApiServer(): ApiServer.
Related Packages
@owlmeans/context—BasicContextbase@owlmeans/server-app— higher-levelmakeContextthat calls this internally@owlmeans/server-config—sservice()used to configure services
