REST API Go (Echo HTTP Framework)
Introduction
here's making REST API with echo Framework (Go Programming Language),
using module based frame thinking
Installation
1. Requirements
c. Database (PostgreSQL)
2.Clone The Projects
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
3. install all the dependencies
a. Go to the project folder
cd ~YOUR/GO/FOLDER/DIRECTORY/src/go-echo-api/
b. then run dep ensure
command.
Database
Firstly you need a Database, and add new database name with
go-echo-api
.Env (environment variable)
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
run the project with
go run main.go
Build
1. Linux
#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/
2. MacOs (Darwin / BSD)
#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/
3. Windows (DOS)
#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/
License
This package is open-sourced software licensed under the MIT license.