here's making REST API with echo Framework (Go Programming Language), using module based frame thinking
a. Golang Language SDK minimal 1.13 https://golang.org/dl/
b. Dep Golang Package Management https://golang.github.io/dep/docs/installation.html
Go to your src/ folder inside go project directory
cd ~YOUR/GO/FOLDER/DIRECTORY/src/
then clone the project
git clone https://github.com/alpakih/go-echo-api.git
a. Go to the project folder
cd ~YOUR/GO/FOLDER/DIRECTORY/src/go-echo-api/
b. then run dep ensure
command.
Firstly you need a Database, and add new database name with
go-echo-api
Make sure dep ensure
is successful, and then make .env file with command
cp .env.example .env
Update the content of .env
value, like the database name
DB_DRIVER=postgres
DB_NAME=echo-api
DB_PORT=5432
DB_HOST=localhost
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_SSL=disable
run the project with
go run main.go
#build for linux (arch amd64)
env GOOS=linux GOARCH=amd64 go build -o go-echo-api-linux-amd64 && mv ./go-echo-api-linux-amd64 ./build/
#build for MacOs (arch amd64)
env GOOS=darwin GOARCH=amd64 go build -o go-echo-api-darwin-amd64 && mv ./go-echo-api-darwin-amd64 ./build/
#build for Windows (arch amd64)
env GOOS=windows GOARCH=amd64 go build -o go-echo-api-windows-amd64.exe && mv ./go-echo-api-windows-amd64.exe ./build/
This package is open-sourced software licensed under the MIT license.