# nuxt-3-axios

> Axios in Nuxt 3

Latest version **1.3.5** (published 2023-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install nuxt-3-axios
pnpm add nuxt-3-axios
yarn add nuxt-3-axios
bun add nuxt-3-axios
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.5 |
| Published | 2023-04-07 |
| First published | 2023-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | am_i_farid |
| Keywords | nuxt, nuxt3, axios, typesafe, isomorphic http, ssr, vue, tajikistan |

## Links

- npm: https://www.npmjs.com/package/nuxt-3-axios
- Repository: https://github.com/farid-temuri-lofty/nuxt-3-axios.git#axios-nuxt
- Homepage: https://github.com/farid-temuri-lofty/nuxt-3-axios/tree/axios-nuxt#readme
- Issues: https://github.com/farid-temuri-lofty/nuxt-3-axios/issues
- npm.io page: https://npm.io/package/nuxt-3-axios

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^1.3.4
- [@nuxt/kit](https://npm.io/package/@nuxt/kit.md) ^3.3.2

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.3.5 (latest) — 2023-04-07
- 1.3.4 — 2023-04-03
- 1.3.3 — 2023-04-03
- 1.3.2 — 2023-04-03
- 1.3.1 — 2023-03-31
- 1.3.0 — 2023-03-31
- 1.2.1 — 2023-03-31

## README

# Axios in Nuxt 3

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

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

- [✨ &nbsp;Release Notes](/CHANGELOG.md)
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/nuxt-3-axios?file=playground%2Fapp.vue) -->
<!-- - [📖 &nbsp;Documentation](https://example.com) -->

## Features


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

`nuxt.config.ts`

```js
export default defineNuxtConfig({
  modules: [
    'nuxt-3-axios'
  ],
  axios:{
    baseURL: 'https://swapi.dev/api/'
    //options to pass Axios Config
  }
})
```
[Axios config options here!](https://www.google.com "Google's Homepage")


`Example.vue`
```js
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

```bash
# 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
```

2. Add `nuxt-3-axios` to the `modules` section of `nuxt.config.ts`

```js
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

```bash
# 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
```

<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/nuxt-3-axios/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/nuxt-3-axios

[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-3-axios.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/nuxt-3-axios

[license-src]: https://img.shields.io/npm/l/nuxt-3-axios.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/nuxt-3-axios

[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
[nuxt-href]: https://nuxt.com

---
_Source: https://npm.io/package/nuxt-3-axios · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
