# Setup

# Install

Install with yarn:

yarn add @nuxtjs/axios

Install with npm:

npm install @nuxtjs/axios

nuxt.config.js

module.exports = {
  modules: [
    '@nuxtjs/axios',
  ],

  axios: {
    // proxyHeaders: false
  }
}

# TypeScript

Add the types to your "types" array in tsconfig.json after the @nuxt/types (Nuxt 2.9.0+) or @nuxt/vue-app entry

tsconfig.json

{
  "compilerOptions": {
    "types": [
      "@nuxt/types",
      "@nuxtjs/axios"
    ]
  }
}

Why?

Because of the way nuxt works the $axios property on the context has to be merged into the nuxt Context interface via declaration merging. Adding @nuxtjs/axios to your types will import the types from the package and make typescript aware of the additions to the Context interface.