Created
December 13, 2021 21:26
-
-
Save leegilmorecode/41a21691e43eb90df11d92c6459b0427 to your computer and use it in GitHub Desktop.
Private DNS on VPC with VPC Endpoints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
async function handler() { | |
const { data } = await axios.get( | |
`https://private-api-id.execute-api.eu-west-1.amazonaws.com/prod/stock`, // ๐ this private call would work | |
{ | |
headers: { | |
"x-api-key": "super-secret-api-key", | |
}, | |
} | |
); | |
console.log(`private call is successful: ${data}`); | |
const { data: test } = await axios.get( | |
`https://public-api-id.execute-api.eu-west-1.amazonaws.com/prod/pets` // ๐ this public call would not | |
); | |
console.log("public call is unsuccessful: ", test); | |
return { | |
body: JSON.stringify(data), | |
statusCode: 200, | |
}; | |
} | |
module.exports = { handler }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment