|
1 week ago | |
---|---|---|
cmd | 1 week ago | |
config | 1 week ago | |
internal | 1 week ago | |
pkg | 3 weeks ago | |
.gitignore | 1 month ago | |
LICENSE | 1 month ago | |
README.md | 1 month ago | |
README_zh.md | 1 month ago | |
go.mod | 3 weeks ago | |
go.sum | 1 month ago |
Nunu is an application scaffold based on Golang. Its name comes from a game character in League of Legends, a little boy riding on the shoulder of a yeti. Like Nunu, this project also stands on the shoulders of giants. It is a composition of various popular libraries from the Golang ecosystem, which can help you quickly build efficient and reliable applications.
.
├── cmd
│ └── server
│ ├── main.go
│ ├── wire.go
│ └── wire_gen.go
├── config
│ ├── local.yml
│ └── prod.yml
├── internal
│ ├── handler
│ │ ├── handler.go
│ │ └── user.go
│ ├── middleware
│ │ └── cors.go
│ ├── model
│ │ └── user.go
│ ├── repository
│ │ ├── repository.go
│ │ └── user.go
│ ├── server
│ │ └── http.go
│ └── service
│ ├── service.go
│ └── user.go
├── pkg
├── LICENSE
├── README.md
├── README_zh.md
├── go.mod
└── go.sum
This is a classic directory structure for a Golang project, which includes the following directories:
cmd: Contains the entry points of the application, including the main function and dependency injection code.
config: Contains the configuration files of the application.
internal: Contains the internal code of the application.
pkg: Contains the public packages of the application.
storage: Contains the storage files of the application.
go.mod: The Go module file.
go.sum: The dependency versions file for the Go module.
To use Nunu, you need to have the following software installed on your system:
You can install Nunu using the following command:
go install github.com/go-nunu/nunu@latest
You can create a new Golang project using the following command:
nunu new projectName
By default, it will pull from the GitHub repository, but you can also use a mirror repository for faster access:
// Use the basic template
nunu new projectName -r https://gitee.com/go-nunu/nunu-layout-basic.git
// Use the advanced template
nunu new projectName -r https://gitee.com/go-nunu/nunu-layout-advanced.git
This command will create a directory named projectName
and generate an elegant Golang project structure within it.
You can create handlers, services, repositories, and models for your project using the following commands:
nunu create handler user
nunu create service user
nunu create repository user
nunu create model user
or
nunu create all user
These commands will create components named UserHandler
, UserService
, UserDao
, and UserModel
respectively and place them in the correct directories.
You can quickly start your project using the following command:
nunu run
This command will start your Golang project and support hot-reloading of files.
You can quickly compile wire.go
using the following command:
nunu wire
This command will compile your wire.go
file and generate the required dependencies.
If you find any issues or have any improvement suggestions, please feel free to raise an issue or submit a pull request. Your contributions are highly appreciated!
Nunu is released under the MIT License. See the LICENSE file for more information.