|
преди 2 години | |
---|---|---|
cmd | преди 2 години | |
config | преди 2 години | |
deploy | преди 2 години | |
internal | преди 2 години | |
pkg | преди 2 години | |
script | преди 2 години | |
test | преди 2 години | |
web | преди 2 години | |
.gitignore | преди 2 години | |
LICENSE | преди 2 години | |
README.md | преди 2 години | |
README_zh.md | преди 2 години | |
go.mod | преди 2 години | |
go.sum | преди 2 години |
Nunu is an application scaffold based on Golang, named after a game character in League of Legends, a little boy riding on the shoulder of a snow monster. Like Nunu, this project also stands on the shoulders of giants, integrating various popular libraries in the Golang ecosystem. Their combination can help you quickly build an efficient and reliable application.
.
├── cmd
│ └── server
│ ├── wire
│ │ ├── wire.go
│ │ └── wire_gen.go
│ └── main.go
├── config
│ ├── local.yml
│ └── prod.yml
├── internal
│ ├── dao
│ │ ├── dao.go
│ │ └── user.go
│ ├── handler
│ │ ├── handler.go
│ │ └── user.go
│ ├── middleware
│ │ └── cors.go
│ ├── model
│ │ └── user.go
│ ├── provider
│ │ └── provider.go
│ ├── server
│ │ └── http.go
│ └── service
│ ├── service.go
│ └── user.go
├── pkg
│ ├── config
│ │ └── config.go
│ ├── helper
│ │ ├── md5
│ │ │ └── md5.go
│ │ ├── resp
│ │ │ └── resp.go
│ │ ├── sonyflake
│ │ │ └── sonyflake.go
│ │ └── uuid
│ │ └── uuid.go
│ ├── http
│ │ └── http.go
│ └── log
│ └── log.go
├── LICENSE
├── README.md
├── README_zh.md
├── go.mod
└── go.sum
This is the directory structure of a classic Golang project, which includes the following directories:
cmd
: Contains the code for command-line applications, such as main.go
.config
: Contains configuration files, such as config.yaml
.internal
: Contains internal code that is not exposed externally.
dao
: Contains the code for Data Access Objects (DAOs).handler
: Contains the code for HTTP request handlers.middleware
: Contains the code for HTTP middleware.model
: Contains the code for data models.provider
: Contains the code for dependency injection.server
: Contains the code for HTTP servers.service
: Contains the code for business logic.pkg
: Contains reusable code that is exposed externally.
config
: Contains the code for reading configuration files.helper
: Contains the code for helper functions.http
: Contains HTTP-related code.log
: Contains code related to logging.To use Nunu, you need to install the following software 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
// or
nunu new projectName -r https://github.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, and daos for your project using the following commands:
nunu create handler user
nunu create service user
nunu create dao 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 file update hot reload.
You can quickly compile your wire.go
file 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. We welcome your contributions!
Nunu is released under the MIT license. See LICENSE for more information.