The MrAndreID/GoAPI is a skeleton uses the Go Programming Language (GoLang) with The Echo Framework for The Application Programming Interface (API).
- Requirements
- Installation
- Migration
- Seeder
- Unit Test
- Usage
- Versioning
- Authors
- Contributing
- Official Documentation for Go Language
- License
To use The MrAndreID/GoAPI, you must ensure that you meet the following requirements:
- Go >= 1.26
To use The MrAndreID/GoAPI, you must follow the steps below:
- Clone a Repository
# git clone https://github.com/MrAndreID/goapi.git
- Get Dependancies
# go mod download
# go mod tidy- Create .env file from .env.example (Linux)
# cp .env.example .env- Configuring .env file
To Run Migration for The MrAndreID/GoAPI, you must ensure that you meet the following requirements:
- Set
USE_DATABASE=trueand Configuring TheDATABASE_*Value in .env file - Run Migration for The
MrAndreID/GoAPI
# go run ./internal/application/database/migration --migrate=default- Run Migration for The
MrAndreID/GoAPIwith Drop All Tables
# go run ./internal/application/database/migration --migrate=freshTo Run Seeder for The MrAndreID/GoAPI, you must ensure that you meet the following requirements:
- Run Migration for The
MrAndreID/GoAPIBefore Run Seeder - Run Seeder for The
MrAndreID/GoAPI
# go run ./internal/application/database/seeder --seed=defaultTo Run Unit Test for The MrAndreID/GoAPI, you must ensure that you meet the following requirements:
- Create .env.test file from .env.test.example (Linux)
# cp .env.test.example .env.test- Configuring .env.test file
- Prepare a PostgreSQL Server for The Repository Unit Test
- Run Unit Test for The
MrAndreID/GoAPI
# go test -v -cover -coverpkg=./internal/feature/... ./internal/feature/... -count=1- Run Unit Test for The
MrAndreID/GoAPIwith Coverage Profile
# go test -v -cover -coverpkg=./internal/feature/... -coverprofile=coverage.out ./internal/feature/... -count=1
# go tool cover -func=coverage.outTo use The MrAndreID/GoAPI, you must ensure that you meet the following requirements:
- Directory Structure The
MrAndreID/GoAPI
| Name | Description |
|---|---|
cmd/api |
Entry Point for The Application |
internal/application |
Initialization of Echo Framework, Middleware, and Routes. |
internal/application/cache |
Configuration for Cache |
internal/application/config |
Configuration from Env File |
internal/application/database |
Configuration for Database |
internal/application/database/migration |
Migration Command |
internal/application/database/seeder |
Seeder Command |
internal/application/dependency |
Feature Dependency Validation on Start Up |
internal/application/message_broker |
Configuration for Message Broker |
internal/application/object_storage |
Configuration for Object Storage |
internal/entity |
Shared Struct Data |
internal/feature/v1/user |
User Feature |
internal/feature/v1/user/test |
Unit Test for User Feature |
storage |
Folder for Add Maintenance Flag File |
storage/log |
Folder for Log File |
- Run The
MrAndreID/GoAPI
# go run ./cmd/api- Run The
MrAndreID/GoAPIwith Docker
# docker build --no-cache -t goapi:1.0.0 .
# docker run --name goapi --restart=always -d -p 10001:10001 -v /path/to/.env:/app/.env:ro -v /path/to/folder:/app/storage goapi:1.0.0
- Set The
MrAndreID/GoAPIto Maintenance Mode in Storage Folder
# touch storage/maintenance.flagI use Semanting Versioning. For the versions available, see the tags on this repository.
- Andrea Adam - MrAndreID
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
Documentation for Go Language can be found on the Go Package website.
The MrAndreID/GoAPI is released under the MIT License. See the LICENSE file for more information.