DApp to communicate with Hyperledger Fabric Blockchain Network
NOTE: This DApp has been tested on Ubuntu 18.04 and on Windows 10 with WSL and Golang 1.18 was used.
ππΎ Read to start DApp in dev mode.
ππΎ The config file
Param | Description | default value |
---|---|---|
APIDocIP | IP to expose the api (unused) | 127.0.0.1 |
DappPort | app PORT | 7001 |
CronEnabled | active the cron job | true |
EveryTime | time interval (in seconds) that the cron task is executed | 300 seconds (every 5 minutes) |
Download the github.template-fabric.dapp-go project and move to root of project:
git clone https://github.com/kmilodenisglez/github.template-fabric.dapp-go.git && cd github.template-fabric.dapp-go
You can start the server in 2 ways, the first is using docker and docker-compose and the second is manually
You will need docker and docker-compose in your system.
To builds Docker image from Dockerfile, run:
docker build --no-cache --force-rm --tag app_restapi .
Use docker-compose to start the container:
docker-compose up
Run:
go mod download
go mod vendor
If you make changes to the Endpoint you must generate Swagger API Spec:
Build:
go build
The environment variable is exported with the location of the server configuration file.
If you have π§Linux or πDash, run:
export SERVER_CONFIG=$PWD/conf/conf.yaml
but if it's the windows cmd, run:
set SERVER_CONFIG=%cd%/conf/conf.yaml
Before it is recommended that you read more about the server configuration file in the section ππΎ .
Run the server:
./github.template-fabric.dapp-go
and visit the swagger docs:
You can then authenticate and test the remaining endpoints.
Run:
go test -v
This project has 3 layer :
- Controller Layer (Presentation)
- Service Layer (Business)
- Repository Layer (Persistence)
Tag | Path | Layer |
---|---|---|
Auth | end_auth.go | Controller |
Dapp | end_dapp.go | Controller |
Auth | svc_authentication.go | Service |
Dapp | svc_dapp.go | Service |
Dapp | repo_dapp.go | Repository |