In vuex store I call up the API Gateway api like this:
import apigClientFactory from 'aws-api-gateway-client';
const apigClient = apigClientFactory.newClient({
invokeUrl: 'https://blahblah.us-east-2.amazonaws.com/dev'
})
I'd like to invoke dev or prod versions of the API dependent on whether the app is in development or production mode. How can I achieve this?
I'm assuming that this is the proper way to go about having a web app use API Gateway. When I am doing development work, it should invoke a dev stage of the API that in turn uses development stage tools (like $latest for lambda). Once those tools are ready, they can be pushed to the stage that the production API is using.
UPDATE: I am not proud of this but I was able to just use an if/else statement to define the correct url based on stage like so:
if (process.env.NODE_ENV !== 'production') {
var apigClient = apigClientFactory.newClient({
invokeUrl: 'apiurl/dev'
});
} else {
var apigClient = apigClientFactory.newClient({
invokeUrl: 'apiurl/prod'
});
}