0👍
✅
Thanks for the suggestions, but my final solution was to deploy on my host server the way I believe it was intended. I made the public folder a root folder and pointed the server to that folder.
0👍
It maybe a flaw in the configuration of your Apache server (or nginx), but I suggest you use a configuration file to avoid problems like this:
// Define different API Url
const urlApiDev = 'urlApiDev'
const urlApiProd = 'urlApiProd'
const secretDev = 'secretDev'
const secretPROD = 'secretProd'
export default {
url: process.env.NODE_ENV === 'development' ? urlApiDev : urlApiProd,
version: 'api/1.0',
clientId: '2',
clientSecret: process.env.NODE_ENV === 'development' ? secretDev :secretPROD,
}
and import it where you need to use it.
0👍
You could simply add a variable in your javascript file to add the path.
var host = window.location.origin;
axios(host + '/api/test').then(response => console.log(response.data);
Hope this works
Source:stackexchange.com