npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

axios-goose

v1.0.4

Published

Axios Goose is a lightweight and simple library that wraps around Axios for making HTTP requests to a RESTful API. This library is designed to streamline the process of managing authorization tokens (access tokens and refresh tokens) and offers a convenie

Readme

Axios-goose 🦆

Axios Goose is a lightweight and simple library that wraps around Axios for making HTTP requests to a RESTful API. This library is designed to streamline the process of managing authorization tokens (access tokens and refresh tokens) and offers a convenient interface for making various types of HTTP requests.

Installation

To install Axios Goose, you can use npm:

npm install axios-goose

Usage

Below is an example of how to use axios-goose in your project:

0. Importing Axios Goose

Import Axios Goose in your project.

import { Axios } from 'axios-goose';

1. Initializing Axios Goose

Initialize Axios Goose before making any requests.

const isAuthReq = true; // Set this to true if you are making authorized requests
const baseURL = 'https://api.example.com'; // Optionally set the baseURL
const axiosInstance = new Axios(isAuthReq, baseURL);

isAuthReq is a boolean that determines whether the requests should contain an Authorization header. You should provide a baseURL which will be used as the base URL for all the HTTP requests made using this axios instance.


2. Making HTTP Requests

GET

To make a simple GET request:

axiosInstance.get('/api/endpoint');

To make a GET request with query parameters:

axiosInstance.getByQuery('/api/endpoint', {
  param1: 'value1',
  param2: 'value2',
});

To make a GET request with path parameters:

axiosInstance.getByParams('/api/endpoint', 'param-value');

POST

To make a POST request:

axiosInstance.post('/api/endpoint', { dataKey: 'dataValue' });

To make a POST request with multipart/form-data:

const formData = new FormData();
formData.append('key', 'value');
axiosInstance.postMultipartFormData('/api/endpoint', formData);

PUT

To make a PUT request:

axiosInstance.put('/api/endpoint', { dataKey: 'dataValue' }, optionalID);

PATCH

To make a PATCH request:

axiosInstance.patch('/api/endpoint', { dataKey: 'dataValue' });

DELETE

To make a DELETE request:

axiosInstance.delete('/api/endpoint', itemID);

Handling Tokens

This library automatically handles access tokens and refresh tokens. Tokens are stored in cookies and are automatically attached to authorized requests. When an access token expires, it attempts to refresh the token using the refresh token.

The library expects that the backend responds with a 1002 status code when the access token is expired.


Token Refresh Endpoint Configuration

In order to enable automatic token refreshing functionality, the backend should provide an endpoint for token refreshing.

Note that this library uses a fixed path /api/auth/refresh-token for token refreshing.

Please ensure that your backend implements an API endpoint at the following path for handling refresh token requests:

/api/auth/refresh-token

This endpoint should accept a POST request with a refresh token, and it should return a new access token if the provided refresh token is valid.

Backend Endpoint Conifguration:

  • HTTP Method: POST
  • Endpoint URL: /api/auth/refresh-token

Request Body:

{
  "refreshToken": "<your-refresh-token>"
}

Response:

{
  "accessToken": "<your-new-access-token>"
}

Please configure your backend service to provide this endpoint with the above specifications to ensure that token refresh works seamlessly with this library.