api

package
v0.0.0-...-df95b03 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

README

API services

This folder contains the description and implementation of the handlers of the APIs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SampleDesc desc.ServiceDescFunc = func() *desc.Service {
	return desc.NewService("SampleService").
		SetEncoding(kit.JSON).
		AddError(dto.Err(http.StatusBadRequest, "INPUT")).
		AddContract(
			desc.NewContract().
				SetInput(&dto.VeryComplexRequest{}).
				SetOutput(&dto.VeryComplexResponse{}).
				AddRoute(desc.Route("ComplexDummy", fasthttp.POST("/complexDummy"))).
				AddRoute(desc.Route("ComplexDummy2", fasthttp.POST("/complexDummy/:key1"))).
				AddRoute(desc.Route("ComplexDummy3", fasthttp.RPC("complexDummy"))).
				AddModifier(func(envelope *kit.Envelope) {
					envelope.SetHdr("X-Custom-Header", "justForTestingModifier")
				}).
				SetHandler(DummyHandler),
		).
		AddContract(
			desc.NewContract().
				SetInput(&dto.VeryComplexRequest{}).
				SetOutput(&dto.VeryComplexResponse{}).
				AddRoute(desc.Route("GetComplexDummy", fasthttp.GET("/complexDummy/:key1/xs/:sKey1"))).
				AddRoute(desc.Route("GetComplexDummy2", fasthttp.RPC("getComplexDummy"))).
				AddModifier(func(envelope *kit.Envelope) {
					envelope.SetHdr("X-Custom-Header", "justForTestingModifier")
				}).
				SetHandler(DummyHandler),
		)
}

Functions

func DummyHandler

func DummyHandler(ctx *kit.Context)

Types

This section is empty.

Jump to

Keyboard shortcuts

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