A simple Node.js API which is intended for networking proof-of-concept testing
206
https://github.com/JayMartMedia/micro-express
A simple express web app that can be used for network testing or experimentation purposes.
The primary reason I built this is to test and demonstrate how network concepts such as reverse-proxies, load-balancers, etc. work. For example, running multiple micro-express containers with different instance ids behind a load balancer allows you to verify that the load balancer is distributing requests between instances. Or that a reverse proxy is sending requests to the expected upstream server based on some criteria. See my nginx playground repository for some examples.
To run a single instance: docker run -d -p 7000:3000 --name 000 -e MESSAGE="Hello from instance #000" -e INSTANCE_ID="000" jaymartmedia/micro-express:0.0.1
Once a container is running, you can use the browser, cURL, or another http client to test access.
curl http://localhost:7000 -> used to verify which instance is being accessed
curl http://localhost:7000/endpoint -> used to verify that requests can access the path/subdirectory since this is sometimes broken by a reverse-proxy
curl http://localhost:7000/headers -> used to test which headers get to the micro-express instance. This is useful if the container is behind a reverse-proxy that may filter out or modify headers
Clone the micro-express GitHub repo: git clone https://github.com/JayMartMedia/micro-express.git
./build.sh
docker run -d -p 7000:3000 --name 000 -e MESSAGE="Hello from instance #000" -e INSTANCE_ID="000" micro-express
Q. Isn't it inaccurate to use "micro" to describe an HTTP API that uses a runtime such as Node, and uses multiple libraries?
A. I don't disagree with you, I guess micro refers to the functionality. A single executable file would definitely be more "micro".
Content type
Image
Digest
sha256:f9893cdcd…
Size
46.1 MB
Last updated
over 2 years ago
docker pull jaymartmedia/micro-express:0.0.1