Registry / devops / cordis-axios

cordis-axios

JSON →
library4.1.0jsnpmunverified

Axios service wrapper for the Cordis dependency injection framework. Current stable version 4.1.0, released as part of the Satori project ecosystem. Provides a simplified API for HTTP requests using Axios, integrated with Cordis's service lifecycle. Key differentiator: automatic context management and lifetime scoping within Cordis applications. Alternative to manual Axios instantiation in Cordis-based projects.

npm install cordis-axios
INSTALL
IMPORT
SIG · CORDIS-AXIOS
C
cordis-axios
devopsjavascriptv4.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AxiosService
import { AxiosService } from 'cordis-axios'
const AxiosService = require('cordis-axios')
ESM-only package; CommonJS require will fail. Use dynamic import if needed.
default
import C from 'cordis-axios'
import * as C from 'cordis-axios'
The package has both named and default exports. Default export is the AxiosService class itself.
AxiosService
import { type AxiosService } from 'cordis-axios'
import type { AxiosService } from 'cordis-axios'
TypeScript: use 'import type' for type-only imports to avoid bundling runtime code.

Shows how to register the AxiosService as a Cordis plugin and make an HTTP GET request using the injected axios instance.

import { Context } from 'cordis' import { AxiosService } from 'cordis-axios' const app = new Context() app.plugin(AxiosService) app.start().then(async () => { const axios = app.get('axios') const res = await axios.get('https://api.example.com/data') console.log(res.data) })
Debug
Known issues
breakingBefore v4, import path was 'cordis-axios/lib' — v4 changed to top-level package exports
fix
Update import to 'cordis-axios'
affects: <4.0.0
deprecatedUsing service name 'http' is deprecated; use 'axios' instead
fix
Use app.get('axios') instead of app.get('http')
affects: >=4.0.0 <5.0.0
gotchaThe axios instance is lazily created; it won't be available until app.start() is called
fix
Access axios instance only after starting the app or within plugin lifecycle hooks
affects: >=4.0.0
Errors
Common errors & fixes
Cannot find module 'cordis-axios' or its corresponding type declarations.
Missing package installation or incorrect TypeScript version.
fix
npm install cordis-axios
Property 'get' does not exist on type 'AxiosService'.
Attempting to call methods on the service class instead of the axios instance.
fix
Use app.get('axios').get(...) or inject the axios instance properly.
TypeError: Cannot read properties of undefined (reading 'get')
Accessing axios before app.start() or before the plugin is loaded.
fix
Ensure app.start() is called and the AxiosService plugin is registered.
Upgrade
Version history
4.1.0latest on npm
Audit
Dependencies
cordisrequiredCore dependency injection framework; required to use the service context
axiosoptionalUnderlying HTTP client library; cordis-axios wraps axios instances
Agent activity
8 hits · last 30 days
node
8
Resources
cordis-axios — npm install cordis-axios · libregistry