Simple API server for ByteBank mobile app add-on. This server was developed 100% in the programming language Go.
Prerequisite to install Bytebank API:
- GoLang to build the application.
- MongoDB local or MongoDB Atlas to store the transactions.
If you use MongoDB Atlas, you need to declare and initialize the following environment variables:
MONGO_USER
: Username to connect with MongoDBMONGO_PASS
: Password to connect with MongoDBMONGO_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.
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
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