vendredi 10 mai 2019

Routing traffic in docker

I'm running integration tests on several AWS Lambda's and I need a way to route API calls to a dummy express server on my local machine. Normally I would just change the url's of the API calls, but the urls are generated in projects that are not apart of this and imported via npm, so hardcoding in a new url isn't practical.

My goal is to have these modules use the URL generated but have that routed to a dummy Express server that I'am running where I will have prepackaged responses so I can test the functionality of these lambdas. For example there is a request for an authorization token from an outside service. Instead of requesting from the actual service it would be routed to my local express server which would just provide a static authorization token. There is then another point where that token is verified and I would again hope that this would get routed to the same server (though in reality it's a different service) and it would verify the token.

Ultimately I will have this dummy Express server, a DynamoDB, and SQS, running on docker containers locally to essentially imitate this software running live.

I've seen that docker can route traffic, but I'm not sure if what I'm attempting to do will be possible. I've googled around but most of the stuff I have found seems a bit more simple then what I'm attempting.

Aucun commentaire:

Enregistrer un commentaire