go-api-now

command module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

README

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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL