A very basic HTTP API that returns current time in Go for testing purpose.
893
This is a very basic HTTP API that returns current time and environment in Go.
In default, the api server is listening to tcp/8000. You can change the port by specifying PORT environment variable.
Sometimes I want to test Docker integration so I need a container image suitable for testing.
e.g.
GET /
?sleep=<duration>: sleep <duration> before returns a responseGET /json
GET /_stats
Build:
$ docker build -t nabeken/go-api-now:latest .
Run:
$ docker run -d -p 8000:8000 nabeken/go-api-now:latest
$ curl -i http://<docker>:8000
Or
$ docker run -d -p 9999:9999 -e PORT=9999 nabeken/go-api-now:latest
$ curl -i http://<docker>:9999
Content type
Image
Digest
sha256:01d1d5448…
Size
7 MB
Last updated
about 8 years ago
docker pull nabeken/go-api-now