CoreStarter
DoNewsCode/core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.
This is a starter template using the DoNewsCode/core framework.
Usage
You can use the fx command to quickly create a project.
fx create helloworld
Or
When you use Git
to generate a project, you need to modify the package name of the project yourself.
git clone https://github.com/DoNewsCode/core-starter.git helloworld
When you use go run main.go
to run the project, the starter uses config.yaml
by default.
You can use the --config
parameter to specify the config file, or use the following command to generate:
cp config.example.yaml config.yaml
When you add other modules, you can use the go run main.go config init -o config.example.yaml
re-build the sample config file.
You will see the following directory structure.
├── app
│ ├── commands
│ │ └── example.go
│ └── module.go # App module
├── docs
│ ├── docsify # Docsify: {hostname:port}/docs/docsify
│ ├── swagger # Swagger Api: {hostname:port}/docs/swagger
│ └── module.go # Docs module
├── internal
│ └── bootstrap
│ ├── bootstrap.go
│ ├── bootstrap_test.go
│ ├── root.go
│ ├── option.go
│ └── register.go # Register global module or dependency
├── .gitignore
├── config.example.yaml # config example file
├── config.yaml # config file
├── go.mod
├── go.sum
├── main.go
└── readme.md
Examples of using other frameworks
Gin
Go Kit
Kratos