A HTTP service with a single endpoint that calculates n-th fibonacci sequence (1, 1, 2, 3, 5, 8, 13 ...) number.
go run main.go
It should show something like:
ApiServer started at http port 8000
- Docker
- First we need to build the docker image for running the application
docker build . -t golang-fibonacc-rest-api
- After the image has been built correctly we can proceed to run it as follows
docker run -p 8000:8000 golang-fibonacc-rest-api
The server will be running on http://localhost:8000 it should behave like this:
> curl http://localhost:8000/fib?n=1
1
> curl http://localhost:8000/fib?n=10
55
> curl http://localhost:8000/fib?n=72
498454011879264
docker tag golang-fibonacc-rest-api thiagodevel/go-fib:0.0.1
docker push thiagodevel/go-fib:0.0.1
kubectl apply -f fib.yaml
kubectl get service
minikube service go-fib-service --url