Axios usage
In this example:
nuxt.config.js
contains :
- the
publicRuntimeConfig
property to add the URL of our API. - the
modules
property to register our@nuxtjs/axios
module.
pages/index.vue
- uses $axios
to fetch our data and $config
to retrieve our API URL.
Learn more about the axios module.
Learn more in the Directory Structure book in the nuxt-config chapter.
Loading CodeSandbox...