CoffeeMachineRestApiV2

command
v0.0.0-...-07d1ea4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

README

CoffeeMachine

CoffeeMachine Rest API implementation in GoLang used for learning GoLang.

Endpoints

CoffeeMachine has endpoint:

  • for initializing
  • /coffeemachine
  • for checking status of ingredient and updating Ingredient model
  • /coffeemachine/ingredient
  • for checking status of money and updating money based on Denomination model
  • /coffeemachine/money
  • for checking all available drinks, adding them and consuming them
  • /coffeemachine/drinks
  • utility
  • /metrics
  • /coffeemachine/health
  • /coffeemachine/swagger/index.html swagger endpoint in restAPIv2

Running CoffeeMachineRestApiV2

Implementation is in-memory only.

Run command in cmd/CoffeeMachineRestApiV2

go build -o coffeeMachine.exe main.go

and run coffeeMachine.exe

API is running in localhost:3000 (port will be customizable in future refactor)

Postman collection can be used for testing. Metrics endpoint is exposed on /metrics Health endpoint is exposed on /coffeemachine/health Logging level can be set with environment variable "LOG_LEVEL" in runtime

Docker

Currently, building Dockerfile from deployments/apiVersion/Dockerfile

Run BuildDocker.ps1 in api folder to automatically build docker image - if you previously set: Set-ExecutionPolicy unrestricted

Or just run BuildDocker.bat

After that you can run this docker image for example on some other port like this:

docker run -p 3002:3000 github.com/kostovic/coffeemachine/restapiv2:0.9.0

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
package controllers
package controllers

Jump to

Keyboard shortcuts

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