No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    axios or routing

    Help
    2
    2
    725
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Axi last edited by

      Hi!
      I’m trying the beta version of quasar-framework 1.x
      I have a .net core application as backend. In my former testings with framework 0.17 I routed all axios requests to api to http://localhost:5000/api and therefore I had settings in quasar.config.js as follows:

      devServer: {
            // https: true,
            // port: 8080,
            open: true, // opens browser window automatically
            proxy: {
              // proxy all requests starting with /api to jsonplaceholder
              '/api': {
                target: 'http://localhost:5000/api',
                changeOrigin: true,
                pathRewrite: {
                  '^/api': ''
                }
              }
            }
          },
      

      In axios.js:

      export default ({ Vue }) => {
        axios.defaults.baseURL = '/api'
        Vue.prototype.$axios = axios
      }
      

      So all axios-requests are going to api and the port 5000 and not to the app port 8080.
      But with beta framework I don’t get the api-calls to this port. axios always try to call port 8080 and not 5000.
      I compared all settings and the only difference I found was, that axios in 0.17 is in the plugin-folder and now it’s in the boot-folder and also in client-entry.js (in .quasar) this plugin is handled differently.
      So what do I have to do (configure) that all my axios calls are going to http://localhost:5000/api/…?
      I hope I explained it clearly and my english wasn’t as bad as I think it is 😉
      Greetings from Tyrol / Austria!
      ©a-x-i

      metalsadman 1 Reply Last reply Reply Quote 0
      • metalsadman
        metalsadman @Axi last edited by

        @Axi set your target url in your axios.js like so.

        export default ({ Vue }) => {
          axios.defaults.baseURL = 'http://localhost:5000/api'
          Vue.prototype.$axios = axios
        }
        
        1 Reply Last reply Reply Quote 2
        • First post
          Last post