angular-environment | AngularJS Environment Plugin | Build Tool library
kandi X-RAY | angular-environment Summary
kandi X-RAY | angular-environment Summary
AngularJS Environment Plugin
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of angular-environment
angular-environment Key Features
angular-environment Examples and Code Snippets
Community Discussions
Trending Discussions on angular-environment
QUESTION
What is the best way to set api url's based on current domain location within the Vue Instance? In angular I would be using something similar to Angular Environment However I have not come accross anything similar with Vue or Axios.
In this case my setup is dependent on multiple environments ( local, dev, stage, prod ). All based on domain relationship.
localhost = '/api-call'
dev.domain.com = 'devapi.domain.com'
prod.domain.com = 'prodapi.domain.com'
Any help at all would be incredible!
...ANSWER
Answered 2017-Jul-21 at 04:12Oftentimes what I would do is store it on the backend in the config file and then set the variable in axios, but you could also test the browser URL on the front-end and set axios accordingly. When creating the axios instance you would set the baseURL property to your main site url.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install angular-environment
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page