Skip to content
/ trial-fiber Public template

Trial or micro-service unit of Golang Fiber framework.

License

Notifications You must be signed in to change notification settings

kamaslau/trial-fiber

Repository files navigation

trial-fiber

License: MIT Repository size

Template Fiber framework project for fast prototyping, trial, or micro-service unit usage.

Make sure that you have Golang installed already.

[🇨🇳 Optional] Setup Mirror for Mainland China

You can skip this one if not approaching the internet from within mainland China.

go env -w GOPROXY=https://goproxy.io,direct # Official
go env -w GOPROXY=https://goproxy.cn,direct # QiniuCloud/七牛云

go env GOPROXY # Double check

Usage

# Create .env file
cp .env.sample .env # specify database connection info

# Install dependencies
go get ./src

# [Optional] Update dependencies
go get -u ./src
go mod tidy

# Run
## With live-reloading (via air-verse/air)
### Install and config air
go install github.com/air-verse/air@latest
air init
### Change the .air.toml file generated
#### macOS/Linux
[build]
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ./src"
#### Windows
[build]
bin = "tmp\\main.exe"
cmd = "go build -o ./tmp/main.exe ./src"
### Use
air

## Without live-reloading
go run src/main.go

# Compile
## Remember to put a .env file in to the same directory with the executable file compiled
go build -o ./dist/main ./src

Deploy with docker

docker build . -t trial-fiber:latest

docker stop trial-fiber && \
docker rm trial-fiber && \
docker run --name trial-fiber -p 3000:3000 -d --restart always --net=host trial-fiber:latest

References/Credits

About

Trial or micro-service unit of Golang Fiber framework.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published