nuxt-3-axios

Axios in Nuxt 3
1,906 1
Install
npm install nuxt-3-axios
Latest Version:1.3.5
Vue:3
License:MIT
Last Updated:Apr 7, 2023
Links: GitHub  ·  npm
Maintainer: am_i_farid

Axios in Nuxt 3

npm version npm downloads License Nuxt

Axios in Nuxt 3 with batteries included for doing amazing things.

Features

Now you can get typed axios instance inside your nuxt app from Nuxt context

nuxt.config.ts

export default defineNuxtConfig({
  modules: [
    'nuxt-3-axios'
  ],
  axios:{
    baseURL: 'https://swapi.dev/api/'
    //options to pass Axios Config
  }
})

Axios config options here!

Example.vue

const { $axios } = useNuxtApp() 

const result = await $axios.get('/people/1')

// result =  {
// 	"name": "Luke Skywalker",
// }

Quick Setup

  1. Add nuxt-3-axios dependency to your project
# Using pnpm
pnpm add -D nuxt-3-axios

# Using yarn
yarn add --dev nuxt-3-axios

# Using npm
npm install --save-dev nuxt-3-axios
  1. Add nuxt-3-axios to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    'nuxt-3-axios'
  ],
  axios:{
    //options to pass to axios create https://axios-http.com/docs/instance
    baseURL: 'https://swapi.dev/api/'
  }
})

That's it! You can now use Axios in Nuxt 3 in your app ✨

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

Related Packages

@oas-ui/nuxt

OAS-UI Nuxt 3 module——SSR(DSD 快照)开箱即用:Vue isCustomElement 配置 + theme...

0 1
firebase-frameworks

Experimental addon to the Firebase CLI to add web framework support

1,005,495 486
portalis-component

Component Library for Nuxt 3 using TailwindCSS

1,284
@nathanchase/nuxt-dayjs-module

This is a Nuxt 3 compatible module built with the official Nuxt 3 (module-builde...

19,376 31

Version History

Version Released Vue License
1.3.5 ^3.0 MIT
1.3.4 ^3.0 MIT
1.3.3 ^3.0 MIT
1.3.2 ^3.0 MIT
1.3.1 ^3.0 MIT