3π
A quick glance at the docs here shows that the recommended setup is to set endpoint
to the base URL of the Api Gateway. For example, if you navigate to the Api Gateway, under "Dashboard", you should see a link similar to the following:
https://1234567.execute-api.us-east-2.amazonaws.com/Stage
This is the link that you should be setting endpoint
to.
Then, you would use it like so:
API
.get("Test", "/path/to/lambda")
.then(response => {
// Add your code here
})
Reference here for usage
However, if youβre using regional endpoints, as referenced here, then your setup is correct, and you would then need to create a new entry for each lambda you have. This is recommended against by the Amplify team though.
Rather than hardcoding, I would recommend setting these URLs as environment variables, which give you a lot more flexibility on deployments.