rest

package module
v0.0.0-...-883ac8e Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 10 Imported by: 0

README

rest

REST server based on Huma and SQLite, for integration into the m5 app

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmbedFS embed.FS

Functions

func GetBody

func GetBody(s string) (string, error)

func GetFrag

func GetFrag(s string) (string, error)

func ListFS

func ListFS(pFS *embed.FS) error

func RunRest

func RunRest(portNr int) error

Types

type HelloReq

type HelloReq struct {
	Name string `path:"name" maxLength:"30" example:"world" doc:"Name to greet"`
}

type HelloRsp

type HelloRsp struct {
	Body struct {
		Message string `json:"message" example:"Hello, world!" doc:"Hello msg"`
	}
}

func DoHello

func DoHello(ctx CTX.Context, pReq *HelloReq) (pRsp *HelloRsp, e error)

type HtmlRsp

type HtmlRsp struct {
	ContentType string `header:"Content-Type"`
	// LastModified time.Time `header:"Last-Modified"`
	// MyHeader     int       `header:"My-Header"`
	Body []byte // not Body struct {..}
}

type HumaHandler

type HumaHandler[I, O any] func(CTX.Context, *I) (*O, error)

type HumaOpSpec

type HumaOpSpec[I, O any] struct {
	HttpVerb  string
	UrlPatrn  string
	InStruct  *I
	OutStruct *O
}

type StaticReq

type StaticReq struct {
}

Jump to

Keyboard shortcuts

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