goteach is golang project template, use echo golang framework.
Requirement:
- Go Programming language
- MySql Database
Installation:
- Clone from github repository: git clone https://github.com/nenjap31/goteach.git
- Install Dep (Dependency Management Tool): curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- Run Command to get the dependencies: dep ensure
- Run Command to update existing dependencies: dep ensure -update
- Set Enviroment Variable from source code directory:
- export goteach_ENV=development
- Create mysql database schema.
- copy cfg/example.json to cfg/dev.json and configure it
- Run mysql database migration: go run main.go migrate up
- Run mysql data seeder: go run main.go seed
- Run it without compile:
- HTTP Service: go run main.go start
- Compile it with command: go build
- Run binary with command:
- HTTP Service: ./goteach start
- cfg: config files location
- cmd: location for code to make CLI command
- config: code location for config files reader
- controllers: location for Accepts input and converts it to commands for the model or view.
- database: location for migration and seeder code
- logger: location for log handling
- models: location for database data model & data logic code
- modules: location for modular logic code
- presenter: location for api response data model
- routes: location for http routing
- script: location for CLI script
- utils: location for other utility code
- Create mysql database schema for testing
- copy cfg/example.json to cfg/testing.json and configure it
- Run test script from project root:
- All Test: ./script/testing.sh ./...
- Single Test: ./script/testing.sh ./folder/folder/
- Or run command manually from project root:
- Set Enviroment Variable from source code directory:
- export GOTEACH_ENV=testing
- export GOTEACH_APP_PATH=$(pwd)
- Reset testing database: go run main.go migrate reset
- Database migration: go run main.go migrate up
- Run data seeder: go run main.go seed
- Run test command:
- All Test: go test ./...
- Single Test: go test ./folder/folder/
- Set Enviroment Variable from source code directory: