helloapi

package module
v0.0.0-...-63cd2eb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 3 Imported by: 0

README

Sample endpoints that return multiple status codes in HTTP transport.

This sample changes the response status according to the contents of the request body. See the Tag documentation for details.

OUTPUT:

Run

$ go run ./cmd/hello -http-port=8080

Access

$ curl -iii -XGET localhost:8080/hello/world
HTTP/1.1 201 Created
Content-Type: application/json
Date: Fri, 05 Apr 2024 13:12:13 GMT
Content-Length: 21

{"greeting":"world"}
$ curl -iii -XGET localhost:8080/hello/aloha
HTTP/1.1 202 Accepted
Content-Type: application/json
Date: Fri, 05 Apr 2024 13:12:31 GMT
Content-Length: 19

{"greeting":"aloha"}
$ curl -iii -XGET localhost:8080/hello/こんにちは
HTTP/1.1 200 OK
Content-Type: application/json
Date: Fri, 05 Apr 2024 13:12:41 GMT
Content-Length: 31

{"greeting":"こんにちは"}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHello

func NewHello(logger *log.Logger) hello.Service

NewHello returns the hello service implementation.

Types

This section is empty.

Directories

Path Synopsis
cmd
gen

Jump to

Keyboard shortcuts

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