Skip to content

Latest commit

 

History

History
47 lines (36 loc) · 1.93 KB

README.md

File metadata and controls

47 lines (36 loc) · 1.93 KB

ByteBank API

Simple API server for ByteBank mobile app add-on. This server was developed 100% in the programming language Go.

Installations

Prerequisite to install Bytebank API:

MongoDB Atlas

If you use MongoDB Atlas, you need to declare and initialize the following environment variables:

  • MONGO_USER: Username to connect with MongoDB
  • MONGO_PASS: Password to connect with MongoDB
  • MONGO_HOST: MongoDB address hostname, DNS or IP (optional, default: localhost)
  • MONGO_PORT: MongoDB address port (optional, default: 27017)
  • MONGO_DB: Database name declared in the MongoDB (optinal, default: bytebank)

Obs: You can use a Makefile to set the environment variables.

Authetication configurations

You need to declare and initialize the following environment variables:

  • Basic HTTP Authentication Scheme. (See more: RFC 7617)
    • AUTH_USER: Anything username (Ex: elonmusk)
    • AUTH_PASS: Anything password (Ex: jeff%1993)

    Obs: External applications that have consumed this API will need to know this username and password for successful communication.

  • PASS_POST: Password to validate transfer storage in database

Application build

Download the necessary dependencies to run the application:

go get

Now just run the application with the following command:

(with MongoDB Atlas)

MONGO_USER=<your user> MONGO_PASS=<your pass> MONGO_HOST=<your host> MONGO_DB=<your database name>  AUTH_USER=<anything> AUTH_PASS=<anything> POST_PASS=<anything> go run main.go

(with local MongoDB)

AUTH_USER=<anything> AUTH_PASS=<anything> POST_PASS=<anything> go run main.go