This repository implements a petstore example with Gohandlers. Click the link to learn about Gohandlers.
There are user provided and Gohandlers generated files in this repository. By default Gohandlers suffixes the files it generates with .gh.go.
-
main.godemonstrates the usage ofListHandlersmethod withhttp.ServeMux. -
handlers/petsdirectory containcreate.go,delete.go,get.goandlist.goshows the suggested format for handler files which contain one handler, its request binding type and optionally its response binding type. -
Makefile,handlers/pets/Makefileshows the gohandlers commands and exact args used in generating this example.
-
handlers/pets/gh.gocontains the builder, parser and validator for request bindings; builder and writer for response bindings and path, method and reference listers for global handlers and method handlers. -
client/client.gh.gocontains the realClientimplementation as well as theInterfacedeclaration for usingMockimplementation during tests. -
handlers/pets/gh.ymlcontains information of handler names, paths and methods that are meant help outside clients.
$ go run .
registering ListPets as GET /pets
registering CreatePet as POST /create-pet
registering DeletePet as DELETE /pets/{id}
registering GetPet as GET /pets/{id}find . -name '*.gh.go' -delete
make -B all
git status