atix

command module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

Atix Lab's chainLog API

Author: Christian Herlein

Description

Challenge API to create an HTTP API to interact with a block-chained CSV log file.

Related docs availables on docs/ with requirements and specifications.

Pre-requisites

Go Installed in version >= v1.13.6

Install instructions: https://golang.org/doc/install

Installing

  go get github.com/chrisherlein/atix

This will install atix command into $GOPATH/bin.

If for any reason, nor Go itself nor this API can not be compiled, you can ask Christian Herlein for a compiled version, by asking for a specific OS / ARCH.

Running

Attached to current session

  atix --port=8080

Kill with: ^C

Dettached from interactive mode:

  nohup atix --port=8080 &

To end up process:

  kill $(pidof atix)

Atix API will handle OS term signal.

For optional params accepted check:

  atix --help

Testing

Run go test into target package's directory:

  cd chainLog
  go test

Expected output will be like:

  PASS
  ok      github.com/chrisherlein/atix/chainLog   0.464s

Documentation

Some human friendly documentation is available into directory docs.

For propper code documentation, godoc (https://blog.golang.org/godoc) should be used:

  godoc --http="127.0.0.1:8081"

Then, interface becomes available in:

  http://localhost:8081/pkg/github.com/chrisherlein/atix/

For interact with the API, use docs/Atix Challenge.postman_collection.json to import into Postman. Then, run requests with the API running.

Application's Logs

There is two available levels of logs: Info and Error. They are handled by logger package.

To enable them, environment vars ATIX_INFO_FILE and ATIX_ERROR_FILE should be set with the path of the desired log file.

  ATIX_INFO_FILE="info.log" ATIX_ERROR_FILE="error.log" atix --port=8080

Note: they are not mandatory and only one of them can be run by its own.

Documentation

Overview

Package main implements the binary way for the challenge.

Instructions on how to compile it are availale into README file

Directories

Path Synopsis
Package app implements the challenge's API There is two methods available: - GET /api/ping - POST /api/log What package actually exports is the App struct throgh the New method.
Package app implements the challenge's API There is two methods available: - GET /api/ping - POST /api/log What package actually exports is the App struct throgh the New method.
Package chainLog is the implementation for the logger
Package chainLog is the implementation for the logger
Package middlewares contains a set of tools used to handle input requests.
Package middlewares contains a set of tools used to handle input requests.

Jump to

Keyboard shortcuts

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