example

command module
v0.0.0-...-80f4f19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 10 Imported by: 0

README

Example Usage

This minimal example demonstrates the funcionality of the oapi_codegen_go build rule.

To run this you'll need to have Bazel installed, and it's also recommended to use Bazelisk to choose a suitable version of Bazel to run. We use Gazelle to manage Go dependencies in Bazel, but that isn't strictly necessary.

Running the example

Run the server:

$ bazel run //cmd/server -- --port=8080

Make some API calls:

$ curl localhost:8080/pets

[]
$ curl \
  -X POST \
  --data '{"name": "Scruffles", "tag": "good dog"}' \
  -H 'Content-Type: application/json' \
  localhost:8080/pets

{"id":1,"name":"Scruffles","tag":"good dog"}
$ curl localhost:8080/pets

[{"id":1,"name":"Scruffles","tag":"good dog"}]

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package server implements the API interface, api.StrictServerInterface, which is auto-generated from the OpenAPI 3 spec, and describes the simple, canonical 'pet store' example.
Package server implements the API interface, api.StrictServerInterface, which is auto-generated from the OpenAPI 3 spec, and describes the simple, canonical 'pet store' example.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL