Skip to content

markot99/myinventory-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

myInventory-backend

Everyone owns a variety of valuable items. In case of theft, fire or other misfortune, the insurance company needs proof of ownership of the items. Most of the time, the proofs are photos and invoices.

The backend will provide functions for inventorying multiple items with pictures and invoices. In addition, user management will be added to allow users to authenticate themselves.

myInventory was created as part of an examination assignment for the module Backend Development.

Further information on the project and the architecture can be found here.

Deployment

The easiest way to deploy myInventory is with the help of Docker. Instructions for installing Docker can be found here.

To start myInventory, change to the root of the repository and enter the following:

docker compose up -d --build

The services are then available under the following URLs:

Configuration

The individual services can be configured via environment variables. All environment variables are optional and have default values.

Api Gateway:

  • PORT can be used to set the internal port.
  • FORWARD_X can can be used to configure the Api Gateway. This can be used to set the host and the path for the forwarding. X must be incremented. Example: FORWARD_1=host;path, FORWARD_2=host;path, ...
  • LOG_LEVEL can be used to set the log level. Permissible values are debug, info, warning and error.

Frontend Service:

  • PORT can be used to set the internal port.
  • LOG_LEVEL can be used to set the log level. Permissible values are debug, info, warning and error.

Item Service:

  • PORT can be used to set the internal port.
  • LOG_LEVEL can be used to set the log level. Permissible values are debug, info, warning and error.
  • MONGO_DB_HOST host url of the mongo db instance
  • MONGO_DB_DATABASE name of the mongodb database
  • ITEM_COLLECTION name of the item collection
  • IMAGE_STORAGE_PATH storage path of the images
  • INVOICE_STORAGE_PATH stroage path of the invoices
  • JWT_SECRET Secret of the JWT tokens. Must match the user service

Swagger Service:

  • PORT can be used to set the internal port.
  • LOG_LEVEL can be used to set the log level. Permissible values are debug, info, warning and error.

User Service:

  • PORT can be used to set the internal port.
  • LOG_LEVEL can be used to set the log level. Permissible values are debug, info, warning and error.
  • MONGO_DB_HOST host url of the mongo db instance
  • MONGO_DB_DATABASE name of the mongodb database
  • USER_COLLECTION name of the user collection
  • JWT_SECRET Secret of the JWT tokens. Must match the item service

Development

Development environment

Visual Studio Code should be used as the development environment. Appropriate launch configurations and tasks for development are already available.

Generate swagger documentation

To generate the Swagger documentation, swag must be installed. Swag can be installed with the following command:

go install github.com/swaggo/swag/cmd/swag@latest

More information about swag can be found here.

Testing

Test files are located directly next to the Go files. MongoDB must be running for the tests to be successful. Tests can be started with the following command from the root of the repository:

go test -p 1 ./... -cover

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages