custom-server/

directory
v0.0.0-...-1fb28bd Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0

README

Go-Swagger: Custom Server Example

An example project, showcasing how one can create a custom OpenAPI-based Go server, using go-swagger to generate its core.

You may regenerate the ./gen directory using the swagger cli:

$ rm -rf gen && mkdir gen && swagger generate server --exclude-main -A greeter -t gen -f ./swagger/swagger.yml

Running the greeter server on port 3000 is as simple as:

$ go run ./cmd/greeter/main.go --port 3000

You can test the server using httpie as follows:

$ http get :3000/hello                  # returns 'Hello, World!'
$ http get :3000/hello name==Swagger    # returns 'Hello, Swagger!'

Directories

Path Synopsis
cmd
gen
restapi
Package restapi Greeting Server
Package restapi Greeting Server

Jump to

Keyboard shortcuts

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