Setup

How to setup your module

Checkout the Nuxt documentation for more information about installing and using modules.

Install

Add @nuxt/http dependency to your project:

yarn add @nuxt/http
npm install @nuxt/http

Then add it to the modules section in your nuxt.config.js:

nuxt.config.js
export default {
  modules: ['@nuxt/http']
}

That's it! You can now use $http in your Nuxt app ✨

Configure

Add a http object to your nuxt.config.js to configure global options which will be applied to all requests

nuxt.config.js
export default {
  modules: [
    '@nuxt/http',
  ],

  http: {
    // proxyHeaders: false
  }
}

See http's options.

Note that this module does not currently support IE 11 because of using ky (open issue)

Edit this page on GitHub Updated at Sat, Feb 27, 2021