How to get baseUrl in Nuxt?

Diolor Source

This is a reliable way to get the host url in both SSR and CSR:

let host = context.req ? context.req.headers.host : window.location.origin

But where to put this so all compoments can access the host? It should be loaded once per page and work with both SSR and CSR.

vue.jsnuxt.js

Answers

comments powered by Disqus