Sign inSign up

nabeken/go-api-now

By nabeken

•Updated about 8 years ago

A very basic HTTP API that returns current time in Go for testing purpose.

Image
0

893

nabeken/go-api-now repository overview

⁠go-api-now

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.

⁠Why?

Sometimes I want to test Docker integration so I need a container image suitable for testing.

e.g.

  • AWS ECS integration
  • AWS CodeDeploy integration
  • Kubernetes integration
  • Heroku integration
  • ...

⁠Endpoints

  • GET /
    • returns the current environment variables
    • ?sleep=<duration>: sleep <duration>⁠ before returns a response
  • GET /json
    • returns the large JSON file
  • GET /_stats
    • returns the current Go's runtime stats

⁠Usage

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

Tag summary

Content type

Image

Digest

sha256:01d1d5448…

Size

7 MB

Last updated

about 8 years ago

docker pull nabeken/go-api-now