This is a template project for developing a REST API service in Golang based on an OpenAPI 3.0 specification.
Use make api-generate to generate server code based on the OpenAPI spec in ./openapi/server.yml.
- Add your functional logic in
./server/api_default_service.go. - Make sure you add this file (and any other you change) to
./server/.openapi-generator-ignoreso that future calls to the generator does not overwrite you changes.
-
Protecting your changes: Test your setup once before you dive into coding and make sure that you added the correct line in your
.openapi-generator-ignorefile. -
Golang Contexts: The generator does not currently support Golang contexts. While this has to be eventually added in
./server/api_default.go, to limit the scope of your changes for now, consider creating a context and passing it on in your controller functions in./server/api_default_service.go.
Go into ./server and run
make run
The default port will be 8080.