Registry / devops / axios-client

axios-client

JSON →
library0.0.9jsnpmunverified

A lightweight client-side API caller built on top of axios, designed to simplify REST API interactions in React applications. Current stable version is 0.0.9 with no active development since 2019. It provides a declarative API config pattern using Endpoint and Request enums, and a RestClient.call() method for making requests. Differentiators include built-in URI parameter substitution via curly braces and a proxy configuration for development. However, the library has severe limitations: it depends on an outdated axios version (^0.18.0), lacks TypeScript definitions, and has no documentation on error handling or response interceptors. The project appears to be in maintenance mode with no recent updates, and the peer dependency on axios 0.18 introduces known security vulnerabilities (CVE-2021-3749).

npm install axios-client
INSTALL
IMPORT
SIG · AXIOS-CLIENT
A
axios-client
devopsjavascriptv0.0.9
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.

Endpoint
import { Endpoint } from 'axios-client'
const Endpoint = require('axios-client')
Library is ESM-only; using require() will fail in Node.js or bundlers expecting CJS.
Request
import { Request } from 'axios-client'
import Request from 'axios-client'
Request is a named export (an object with GET, POST, PUT, DELETE). Common mistake is default import.
RestClient
import { RestClient } from 'axios-client'
import { RestClient } from './axios-client'
RestClient is a named export. Relative import with './' is incorrect; use package name.
Request.GET
import { Request } from 'axios-client'; Endpoint(Request.GET, '/api/path')
Endpoint('GET', '/api/path')
Request.GET is a string enum value ('GET'), but common mistake is passing raw string instead of using the Request object.

Shows how to define API endpoints with Endpoint and Request, then call them using RestClient.call() with URI parameters.

// apiConfig.js import { Endpoint, Request } from 'axios-client'; const apiConfig = { getUsers: Endpoint(Request.GET, '/api/users'), getUser: Endpoint(Request.GET, '/api/users/{id}'), createUser: Endpoint(Request.POST, '/api/users'), updateUser: Endpoint(Request.PUT, '/api/users/{id}'), deleteUser: Endpoint(Request.DELETE, '/api/users/{id}'), }; export default apiConfig; // Example usage in a component import { RestClient } from 'axios-client'; import apiConfig from './apiConfig'; async function fetchUser(id) { try { const response = await RestClient.call(apiConfig.getUser, { id }, null); console.log(response.data); } catch (error) { console.error('API call failed:', error); } }
Debug
Known issues
breakingaxios has a known vulnerability CVE-2021-3749 (SSRF) in versions < 0.21.1. Dependency axios ^0.18.0 is vulnerable.
fix
Upgrade to a newer version of axios (or use a different library) as axios-client does not support newer axios.
affects: >=0.0.0
deprecatedThe library has not been updated since 2019 and is effectively in maintenance mode. No TypeScript definitions provided.
fix
Consider using axios directly or a maintained wrapper like axios-retry or openapi-client.
affects: >=0.0.0
gotchaRequires manual proxy configuration in package.json for development, which only works with create-react-app.
fix
For other setups, configure a proxy via webpack devServer or a dedicated proxy library.
affects: >=0.0.0
gotchaRestClient.call() does not support per-request configuration like headers, timeout, or interceptors; uses global axios defaults.
fix
Use axios directly for advanced use cases; this library is only for simple CRUD operations.
affects: >=0.0.0
gotchaEndpoint function does not validate HTTP method; passing incorrect method (e.g., 'PATCH') results in runtime error.
fix
Only use Request.GET, POST, PUT, DELETE as defined.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'axios-client'
Package not installed or import path is wrong.
fix
Run 'npm install axios-client' or 'yarn add axios-client' and ensure import uses package name, not relative path.
TypeError: Request.GET is undefined
Request is imported incorrectly (e.g., default import instead of named import).
fix
Use 'import { Request } from 'axios-client''.
Unhandled Promise Rejection: AxiosError: Network Error
No proxy configured or CORS issues when calling API in development.
fix
Add a proxy in package.json: "proxy": "http://api.example.com".
RestClient.call is not a function
RestClient imported incorrectly or wrong version.
fix
Ensure 'import { RestClient } from 'axios-client'' and check that the package version supports it.
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies
axiosrequiredPeer dependency for HTTP requests; library is a wrapper around axios
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
axios-client — npm install axios-client · libregistry