The program assumes that you already have a Postgres database and Go installed.
To run the project in development mode, we must follow these steps:
- Clone the repository
- Download dependencies:
go mod tidy - Configure environment variables according to the .env.example
- Run the program:
go run main.go - The program will be running on port 8080
- View swagger documentation on http://localhost:8080/swagger/index.html
To run the unit tests, we need to make use of Go's testing library. Make sure you have the necessary testing files in your project. They usually have the format *_test.go. Once you've confirmed this, you can run your tests within vscode by right-clicking on the test file and selecting "Run Test".
For deployment on Heroku, you need to have the Heroku CLI installed and logged into your Heroku account. If you've not set up your Heroku CLI, you can follow this guide.
Then, follow the steps below:
- Create a new Heroku app:
heroku create - Add all your changes:
git add . - Commit your changes:
git commit -m "Initial commit" - Push the project to Heroku:
git push heroku master - Configure environment variables according to the .env.example, using the heroku dashboard or the heroku cli:
heroku config:set MODE=dev SERVER_PORT=8080 DB_HOST=postgres DB_USER=root DB_PASSWORD=12323 DB_PORT=3000 WOMPI_PUBLIC_KEY= WOMPI_PRIVATE_KEY= WOMPI_INTEGRITY_KEY=