This Golang application consumes a JSON payload from data.gov, populates expense Actuals database and displays the database contents on a web page.
Frameworks used:
- Echo to build the website: https://github.com/labstack/echo
- Resty to retrieve data from Data.gov: https://github.com/go-resty/resty
- Jsonparser to process the data: https://github.com/buger/jsonparser
- GORM to populate the database: https://github.com/jinzhu/gorm
Create a velocity_works.ini configuration file and place it wherever you want. Configuration should look like this
[main]
templates_directory = /home/hostname/path/to/proj-dir/Golang-Demo/contrib/templates
[database]
host = localhost
name = velocity_works
password =postgres
port = 5432
user = username
put this line into ~/.bashrc file
export VELOCITY_WORKS_SETTINGS=path/to/config/velocity_works.ini
change path/to/config/
with your config path.
in order to run migration you need to install golang-migrate/migrate
after installing run this command from project's directory
migrate -path ./contrib/migrations/ -database "postgres://USERNAME:@localhost:5432/DBNAME?sslmode=disable" up
change USERNAME and DBNAME with you username and dbname
Run make command it will take care of rest
make
./bin/velocity-worker --help
./bin/velocity-worker sync_db
./bin/velocity-worker serve_ui