Categorygithub.com/Semior001/decompract
repository
0.1.1
Repository: https://github.com/semior001/decompract.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Decompract Go Coverage Status godoc Go Report Card

Build and Deploy

Build a binary file

GOOS=windows GOARCH=386 go build -o builds/decompract.exe ./app
GOOS=linux GOARCH=386 go build -o builds/decompract_linux ./app
GOOS=darwin GOARCH=amd64 go build -o builds/decompract_macos ./app

Environment variables

The application awaits next environment variables provided in .env file in the project folder:

EnvironmentDefaultDescriptionExample
DEBUGfalseTurn on debug modetrue
SERVICE_URLURL to the backend servicehttp://0.0.0.0:8080/
SERVICE_PORT8080Port of the backend servuce8080

Run the application

Binary file:

decompract server --service_url=http://0.0.0.0:8080/ --service_port=8080
docker-compose up -d

Env file example

DEBUG=true
SERVICE_URL=http://0.0.0.0:8080/
SERVICE_PORT=8080

Backend REST API

Several notes:

  • All timestamps in RFC3339 format, like 2020-06-30T22:01:53+06:00.
  • All durations in RFC3339 format, like 1h30m5s.
  • Clocks should be represented in ISO 8601 format, like 15:04:05.

Errors format

Unauthorized

In case if the user requested a route without proper auth, the 401 status code will be returned with the Unauthorized body content.

General

Example:

{
	"code"     : 0,
	"details"  : "failed to update event",
	"error"    : "event not found"
}

In case of bad client request error might have null value.

Supported error codes for client mapping:

const (
	ErrInternal   ErrCode = 0 // any internal error
	ErrDecode     ErrCode = 1 // failed to unmarshal incoming request
	ErrBadRequest ErrCode = 2 // request contains incorrect data or doesn't contain data
)

Client methods