Hi!
I can to retrieve a relative path of the file field value

    uri: {
      value: 'public://images/blog/2019-06/9700123_.jpg',
      url: '/sites/default/files/images/blog/2019-06/9700123_.jpg'
    },

How I can to get full path with host and domain in file_field{ uri { url }}

Or I must to add host and domain to this url on frontend?

Thank you!

Comments

alexd73 created an issue. See original summary.

alexd73’s picture

Issue summary: View changes
wim leers’s picture

Status: Active » Fixed
Issue tags: +API-First Initiative

Or I must to add host and domain to this url on frontend?

Indeed, the client/front end must prepend the appropriate domain. Note that for most use cases, you don't need to do this.

alexd73’s picture

I added backendUrl variable in nuxt.config.js
And used him in my api client:

  async getUrl(id) {
    const file = await this.find({ id })
    return process.env.backendUrl + file.uri.url
  }

I hope, it correct solution :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.