Skip to content

Latest commit

 

History

History
139 lines (94 loc) · 4.04 KB

README.DEV.md

File metadata and controls

139 lines (94 loc) · 4.04 KB

🛰 START in DEV MODE

NOTE: This DApp has been tested on Ubuntu 18.04 and on Windows 10 with WSL and Golang 1.18 was used.

👀 CodeReviewComments 👀

Table of Contents

🛠️️ Configuration file (conf.yaml)

👉🏾 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)

⚡ Get Started

Download the github.template-fabric.dapp-go project and move to root of project:

git clone https://github.com/ic-matcom/academic_certificate.dapp-go.git && cd academic_certificate.dapp-go

🚀 Start DApp in dev mode

Run:

go mod download
go mod vendor

If you make changes to the Endpoint you must generate Swagger API Spec:

swagger doc

Build:

go build -o dapp

🌍 Environment variables

The environment variable is exported with the location of the server configuration file.

If you have 🐧Linux or 🍎Dash, run:

source ./setenv.sh

but if it's the windows cmd, run:

source ./setenv.cmd

Configure the dapp

Dapp config file:

cp conf/conf.sample.unix.yaml conf/conf.yaml

Network profile:

cp conf/cpp.sample.unix.yaml conf/cpp.yaml

Modify the crypto-config paths in conf/cpp.yaml file, in our case it is /home/user/fabric-folder/fabric-testnet-nano-without-syschannel

🏃🏽‍♂️ Start the server

Before it is recommended that you read more about the server configuration file in the section 👉🏾 .

Run the server:

./dapp

and visit the swagger docs:

http://localhost:7001/swagger/index.html

swagger ui

You can then authenticate and test the remaining endpoints.

🧪 Unit or End-To-End Testing

Run:

go test -v

🔨 Tech and packages

📐 Architecture

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

📐 Swagger

Read swagger doc