- Introduction
- Build
2.1. Exec
2.2. Docker - Deploy
3.1. Kubernetes - Usage
- Continous Integration
Simple Go Calculator project with some math function:
- Sum
- Sqrt
- Factorial
- IsPrime
- Log
go build -o main cmd/calculator/main.go
./main
http://localhost:8888/
docker build -t go-calc -f build/package/Dockerfile .
docker run -d -p 80:8888 go-calc
http://localhost/
kubectl create -f deployments/kubernetes/k8s-replicaSet.yml
http://192.168.99.100:30000/
- SUM
- (x int64, y int64)
- http://localhost:8888/v1/sum
- JSON: {"num1":"2","num2":"4"}
- curl:
curl --location --request POST "http://localhost:8888/v1/sum" \
--header "Content-Type: application/json" \
--data "{\"num1\":\"2\", \"num2\":\"4\"}"
- SQRT
- (x float64)
- http://localhost:8888/v1/sqrt
- JSON: {"number":"144"}
- curl:
curl --location --request POST "http://localhost:8888/v1/sqrt" \
--header "Content-Type: application/json" \
--data "{\"number\":\"144\"}"
- FACTORIAL
- (n uint64)
- http://localhost:8888/v1/factorial
- JSON: {"number":"6"}
- curl:
curl --location --request POST "http://localhost:8888/v1/factorial" \
--header "Content-Type: application/json" \
--data "{\"number\":\"6\"}"
- ISPRIME
- (n int)
- Function IsPrime returns bool, according to provided number (if it's prime or not).
- http://localhost:8888/v1/isPrime
- JSON: {"number":"6"}
- curl:
curl --location --request POST "http://localhost:8888/v1/isPrime" \
--header "Content-Type: application/json" \
--data "{\"number\":\"6\"}"
- LOG
- (n float64)
- http://localhost:8888/v1/log
- JSON: {"number":"6"}
- curl:
curl --location --request POST "http://localhost:8888/v1/log" \
--header "Content-Type: application/json" \
--data "{\"number\":\"6\"}"