Axios usage
In the first example we show how to use the env property in our nuxt.config.js file to add the URL of our API so that we can then easily make calls to it without having to use the URL on our page
In this example:
nuxt.config.js contains :
- 
the 
publicRuntimeConfigproperty to add the URL of our API. - 
the 
modulesproperty to register our@nuxtjs/axiosmodule. 
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 Sandbox...
 
        Edit this page on GitHub
        
      Updated at Mon, Feb 28, 2022
    
 
 
        Leoš Literák
       
 
        Trizotti
       
 
        Clément Ollivier
       
 
        Sébastien Chopin
       
 
        Marcello Bachechi
       
 
        Rodolphe
       
 
        Thomas Underwood
       
 
        Shek Evgeniy
       
 
        felipesuri
       
 
        Lukasz Formela
       
 
        Hugo Torzuoli
       
 
        Sylvain Marroufin
       
 
        Kareem Dabbeet
       
 
        tramplay
       
 
        Daniel Roe
       
 
        verebelyicsaba
       
 
        Adam
       
 
        Nate Butler
       
 
        Sandra Rodgers
       
 
        Arpit Patidar
       
 
        Matthew Kuehn
       
 
        Steven DUBOIS
       
 
        Travis Lindsey
       
 
        syagawa
       
 
        Maxime
       
 
        かる
       
 
        Al Power
       
 
        Florent Delerue
       
 
        quanghm
       
 
        José Manuel Casani Guerra
       
 
        Unai Mengual
       
 
        kazuya kawaguchi
       
 
        Michael Lynch
       
 
        Tomachi
       
 
        pooya parsa
       
 
        Meir Roth
       
 
        Brett
       
 
        Adam Miedema
       
 
        Thomas Bnt
       
 
        Kazuki Furukawa
       
 
        Anthony Ruelle
       
 
        Christophe Carvalho Vilas-Boas
       
 
        Roman Harmyder