Git Product home page Git Product logo

Comments (3)

d4rkr3pt0r avatar d4rkr3pt0r commented on May 23, 2024

@BennieBe Did you try complete url instead of '/api/data' ?

from laravel-nuxt.

Geowan avatar Geowan commented on May 23, 2024

You may need to configure axios base url

Example in my project i have setup axios like

I have also added the dotenv axios module so that i can simply load env url for axios

So simply in your nuxtjs config add

      modules: [
         '@nuxtjs/axios', '@nuxtjs/dotenv'
       ],
      axios: {
         baseURL: Env.get('AXIOS_BASE_URL', 'https://myurl.com'),
      },

So in your usual env file add

      AXIOS_BASE_URL=http://myapiurl

So when you call

       $axios.$get('/api/data')

It will translate to http://myapiurl/api/data

from laravel-nuxt.

BennieBe avatar BennieBe commented on May 23, 2024

Hi @Geowan alright, I will try this, thanks!

from laravel-nuxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.