Search code examples
node.jsamazon-web-servicesaws-api-gateway

How to use API Gateway to fire localhost?


I'm trying to experiment a little, using nodejs and AWS API Gateway.

app.post('/test', (req, res) => {
  res.send('HOLA');
})

And I've fired using postman to http://localhost:3000/test and get the response correctly.

Now I'm trying to play around with AWS API Gateway, but seems like it's not allow to fire to localhost? I'm wondering if there's any get around way for me to just play around

enter image description here


Solution

  • You cannot call localhost via api-gateway, since it refers to localhost of that instance of api-gateway and call will never made to your machine.

    You can use services like, https://ngrok.com/ to convert your localhost url to an internet url.

    This way, https://youareawesome.ngrok.com will get forwarded to your localhost with a tunnel.

    Hope it helps.