Skip to content

API for managing a virtual library where books can be downloaded and stored in a Google Cloud Platform bucket.

Notifications You must be signed in to change notification settings

Leonardo404-code/library-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library-API

API for virtual library management, where possible:

  • Perform CRUD operations in books
  • Upload the book to a Google Cloud Platform bucket
  • Delete book from Google Cloud bucket
  • Download books

API Documentation

See swagger.json

How to run

Configure Bucket in GCP

  • Create the bucket
  • Create a service account in the following directory:
/config/credentials

Setup Database

  • Install docker

Docker is a software platform that allows developers to create, deploy, and run applications in containers. See the official documentation for install the version compatible with your OS: Install Docker Engine

  • Run Docker Compose
docker compose -f ./config/docker/docker-compose.yml up -d --build

Download project dependencies

  • Inside lib-api directory, run:
go mod vendor

Configure the project

  1. Setup the environment variables listed below in directory:
/config/env/envs.yaml
  1. Inside lib-api directory, run:
go run cmd/server/main.go

Test

  1. Inside lib-api directory, run:
go test ./... -v

You should see messages like:

test output

Environment Variables

Name Description Default
DATABASE.USER Username to access database root
DATABASE.PASSWORD Password to access database 12345678
GCP.BUCKET_NAME Name of the bucket that will manage the book files on Google Cloud Platform library
GCP.CREDENTIALSPATH Path of the service account that will give free access to the bucket config/credentials/service_account.json

About

API for managing a virtual library where books can be downloaded and stored in a Google Cloud Platform bucket.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages