lkrzyzanek / helloworld-restapi

Minimalistic hello world REST API in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

helloworld-restapi

Minimalistic hello world REST API written Go.

On any request it returns

{
  "message": "hello world",
  "version": 0
}

How to run

docker run --rm -p 8080:8080 helloworld-restapi:latest

you can change latest to 1.0 or 2.0 to simulate different APIs.

Run application locally

Build app

go build

Run

./helloworld-restapi

Run as local docker image

docker build . -t helloworld-restapi:latest

To run the image execute

docker run --rm -p 8080:8080 helloworld-restapi:latest

To the image try this URLs

Run on Kubernetes

predefined deployment.yaml

kubectl create namespace restapi
kubectl -n restapi apply -f k8s/deployment.yaml

or manually

kubectl -n restapi create deployment restapi --image lkrzyzanek/helloworld-restapi:latest
kubectl -n restapi expose deployment restapi --type=NodePort --port=8080

About

Minimalistic hello world REST API in Go

License:Apache License 2.0


Languages

Language:Go 50.7%Language:Dockerfile 49.3%