hz basic usage

Basic Usage

new: Create a new Hertz project

  1. Create a new project
// Execute under GOPATH, go mod name defaults to the current path relative to GOPATH, or you can specify your own
hz new

// Execute under non-GOPATH, you need to specify the go mod name
hz new -mod hertz/demo

// Tidy & get dependencies
go mod tidy

After executed, it generates a scaffold for the Hertz project in the current directory.

  1. Compiling Projects
go build
  1. Run the project and test it

Run the project:

./{{your binary}}



If it returns {"message":"pong"}, it works.