hello-world

command module
v0.0.0-...-41cbe60 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Hello World

Hello World application written in Go.

Features

  • Always returns a HTTP 200 status code and a "Hello, World!" message at the / path.
  • Has a metrics endpoint at /metrics that returns Prometheus metrics.
  • Has a health check endpoint, /health, that returns an empty response and a HTTP 200 response.

Build

make deps
make build

or

docker-compose build

Usage

local
./hello_world                                                         <region:ap-southeast-2>
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env: export GIN_MODE=release
 - using code: gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /metrics                  --> github.com/zsais/go-gin-prometheus.(*Prometheus).SetMetricsPath.prometheusHandler.func2 (4 handlers)
[GIN-debug] GET    /health                   --> main.healthFunc (6 handlers)
[GIN-debug] GET    /                         --> main.helloFunc (6 handlers)
[GIN-debug] GET    /version                  --> main.versionFunc (6 handlers)
[GIN-debug] Environment variable PORT is undefined. Using port :8080 by default
[GIN-debug] Listening and serving HTTP on :8080
Docker
docker run \
  --detach \
  --name hello-world \
  --publish 8080:8080 \
  ghcr.io/sammcj/hello-world

curl the container

curl http://0.0.0.0:8080/

curl the health check endpoint which returns an empty 200 response

curl http://0.0.0.0:8080/health

curl Prometheus metrics

curl http://0.0.0.0:8080/metrics

Acknowledgements

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
⌂ 换网址