book_store_items-api

command module
v0.0.0-...-0194b74 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: MIT Imports: 1 Imported by: 0

README

book_store_items-api

Items API

This application follows the Model, View, and Controller (MVC) pattern.

It also uses the gorilla mux HTTP framework to handle the requests.

Item is the core domain of this application.

alt text

Getting Started

Prerequisites
Environment variables
    export ES_URL="http://127.0.0.1:9200"
Installing and running locally
# Install dependencies
make install

# Run postgres locally as a container
make env

# Run server locally
make run

# Run server locally with custom environment variables
MYSQL_URL=root:passwd@tcp(127.0.0.1:3305)/users_db?charset=utf8 \
make run
Setting up git hooks

After cloning the repository, change the git hooks path so it's only possible to commit code with the required quality.

make git-config

Running the tests and coverage report

To view report of tests locally use the following command:

make env # prepares environment for testing
make test

Running the lint verification

make lint

Lint report generate by GolangCI-lint.

Running vulnerability check in Go dependencies

make audit

Audit report generate by Nancy.

Deployment

Build
make build
Create release image, add tag and push

Tip: Do not forget to login to docker hub account.

docker login -u "username" -p "access_token" docker.io
make image tag push
OR
make image
make tag VERSION=1.0.0
sudo make push VERSION=1.0.0

Note: Change the version to the desired version.

Run registry image locally

Tip: Before running it locally you need to prepare the environment with the following command.

make env

It creates the network and the database containers.

make run-docker

make remove-docker

Project Structure

Package organization

The package structure used in this project was inspired by the golang-standards project.

Project layers organization

The project layers structure used in this project was inspired by the Hexagonal Architecture (Ports & Adapters).

Contributing

See CONTRIBUTING documentation for more details.

Changelog

See CHANGELOG documentation for more details.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
domain
items
Package items is the persistence layer of items domain.
Package items is the persistence layer of items domain.
internal
utils

Jump to

Keyboard shortcuts

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