Registry / devops / axios-endpoints

axios-endpoints

JSON →
library1.0.3jsnpmunverified

Axios Endpoints (v1.0.3) is a lightweight wrapper around axios for defining endpoint mappings with a concise API. It provides both a default Endpoint class for quick setup (uses global axios) and a Factory pattern that accepts a custom axios instance for full configuration control. Supports GET, POST, PUT, DELETE methods, dynamic URI parameters via function-based endpoint definitions, and Promise/async-await patterns. No releases since initial 1.0.0; maintained in passive state. Differentiator: simplifies endpoint creation vs raw axios by encapsulating base URLs and method calls. Ships TypeScript types. Requires axios as a peer dependency.

npm install axios-endpoints
INSTALL
IMPORT
SIG · AXIOS-ENDPOINTS
A
axios-endpoints
devopsjavascriptv1.0.3
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-endpoints'
import Endpoint from 'axios-endpoints'
Named export only; no default export.
EndpointFactory
import EndpointFactory from 'axios-endpoints'
const EndpointFactory = require('axios-endpoints')
Default export for Factory; ESM usage shown. CJS: const EndpointFactory = require('axios-endpoints').default.
Endpoint (via Factory)
import axios from 'axios'; import EndpointFactory from 'axios-endpoints'; const Endpoint = EndpointFactory(axiosInstance)
import { EndpointFactory } from 'axios-endpoints'
EndpointFactory is the default export, not a named export. Common mistake: trying named import.

Sets up an axios instance with a base URL, creates an Endpoint constructor via the Factory, instantiates an endpoint for '/users', and performs a GET request.

import axios from 'axios'; import EndpointFactory from 'axios-endpoints'; const axiosInstance = axios.create({ baseURL: 'https://api.example.com' }); const Endpoint = EndpointFactory(axiosInstance); const userEndpoint = new Endpoint('/users'); async function main() { try { const { data } = await userEndpoint.get(); console.log(data); } catch (error) { console.error(error); } } main();
Debug
Known issues
gotchaUsing default export for Endpoint via named import: import { Endpoint } from 'axios-endpoints' works, but import Endpoint from 'axios-endpoints' will get 'undefined'.
fix
Use named import: import { Endpoint } from 'axios-endpoints'
affects: >=1.0.0
gotchaFactory is the default export; named import { EndpointFactory } is undefined.
fix
Use default import: import EndpointFactory from 'axios-endpoints'
affects: >=1.0.0
deprecatedPackage is in maintenance mode; no active development or releases since v1.0.0.
fix
Consider alternatives like axios itself or more active wrappers.
affects: >=1.0.0
gotchaTypeScript users may need to install @types/axios separately if not already present.
fix
npm install --save-dev @types/axios
affects: >=1.0.0
gotchaFunction-based endpoints must return a string; returning undefined causes runtime error.
fix
Always return a string from the endpoint function, e.g., ({id}) => '/post/' + (id || '')
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Class constructor Endpoint cannot be invoked without 'new'
Using Endpoint without 'new' keyword (e.g., const ep = Endpoint('/path') instead of new Endpoint('/path')).
fix
Always instantiate with the 'new' keyword: const ep = new Endpoint('/path')
Uncaught TypeError: axios_1.default.create is not a function
Incorrect import of axios (e.g., import axios from 'axios' in a CJS context where axios is required differently) or missing axios installation.
fix
Ensure axios is installed: npm install axios. In ESM, import axios from 'axios' works. In CJS, use const axios = require('axios');
TypeError: (0 , axios_endpoints_1.Endpoint) is not a constructor
Using named import for Endpoint in a TypeScript/ESM context but the import path might be wrong or the package is not properly resolved.
fix
Confirm import: import { Endpoint } from 'axios-endpoints' and ensure the package is installed.
Cannot find module 'axios-endpoints'
Package not installed or missing from node_modules.
fix
Run npm install axios-endpoints
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
axiosrequiredpeer dependency; axios-endpoints is a wrapper around axios
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources
axios-endpoints — npm install axios-endpoints · libregistry