Axios plugin for Nuxt.js [JavaScript/TypeScript]


axios-module is secure and easy axios integration for Nuxt.js.

🐠 Installation

yarn add @nuxtjs/axios

🐹 Configuration

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

axios: {
// proxyHeaders: false
}
}

🤔 How to use

Get data in store actions

{
actions: {
async getIP ({ commit }) {
const ip = await this.$axios.$get('http://icanhazip.com')
commit('SET_IP', ip)
}
}
}

Set header information

// Adds header: `Authorization: 123` to all requests
this.$axios.setHeader('Authorization', '123')

😀 More details

Please see official document Nuxt Axios Module.

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!