axios or routing

  • 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!

  • @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

Log in to reply