Nuxt.js: ssr asyncData

Created on 12 May 2017  路  2Comments  路  Source: nuxt/nuxt.js

in my page component i have

async asyncData ({ store }) {
  let { data } = await axios.get('//127.0.0.1:4000/api/files')

  store.commit('files/filesAdded', {files: data.files})
},

when i open different route and navigate to this one, files are fetched as the should, but when i open this route directly, i get error

Nuxt.js Error:

Error: connect ECONNREFUSED 127.0.0.1:80
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)

it is odd, that it tries to connect to port 80, i only use 4000 port for my backend.

This question is available on Nuxt.js community (#c609)
help-wanted

Most helpful comment

@revati The // at beginning implies same port as current page url (you need to specify protocol which is probably http for SSR or both)
https://url.spec.whatwg.org/#scheme-relative-special-url-string

All 2 comments

@revati The // at beginning implies same port as current page url (you need to specify protocol which is probably http for SSR or both)
https://url.spec.whatwg.org/#scheme-relative-special-url-string

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maicong picture maicong  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments

vadimsg picture vadimsg  路  3Comments

danieloprado picture danieloprado  路  3Comments

jaredreich picture jaredreich  路  3Comments