More Premium Hugo Themes Premium Nuxt Themes

Axios Module

Secure and easy axios integration for Nuxt 2

Axios Module

Secure and easy axios integration for Nuxt 2

Author Avatar Theme by nuxt-community
Github Stars Github Stars: 1192
Last Commit Last Commit: Sep 11, 2023 -
First Commit Created: Dec 18, 2023 -
default image

Overview

@nuxtjs/axios is a secure and easy Axios integration for Nuxt 2. It provides a seamless way to use Axios in Nuxt applications for both client and server-side requests.

Features

  • Automatically set base URL for client & server-side: The module automatically sets the base URL for Axios requests, making it easier to manage API endpoints.
  • Exposes setToken function to $axios: This feature allows setting authentication tokens globally and easily using the setToken function.
  • Automatically enables withCredentials: When requesting to the base URL, withCredentials is automatically enabled, ensuring proper handling of cookies.
  • Proxy request headers in SSR: The module allows proxying request headers during server-side rendering, making it easier to handle authentication or other custom headers.
  • Fetch Style requests: The module supports Fetch Style requests, providing a more modern approach to making API requests.
  • Integrated with Nuxt progress bar: The module is integrated with the Nuxt progress bar, providing a visual indication of API request progress.
  • Integrated with Proxy Module: It seamlessly integrates with the Nuxt Proxy Module, allowing easy proxying of API requests.
  • Auto retry requests with axios-retry: The module supports automatic retry of failed requests using the axios-retry library.

Installation

To install @nuxtjs/axios, you can follow these steps:

  1. Clone this repository.
  2. Install the dependencies using either yarn install or npm install.
  3. Start the development server using npm run dev.

Summary

@nuxtjs/axios provides a secure and easy integration of Axios into Nuxt applications. With features like automatic base URL setting, global token authentication, and support for modern Fetch Style requests, it simplifies the process of making API requests in Nuxt projects. Additionally, it integrates seamlessly with the Nuxt progress bar and Proxy Module, further enhancing the development experience.