go.anx.io/e5e/v2


go-e5e

PkgGoDev Build Status codecov Go Report Card

go-e5e is a support library to help Go developers build Anexia e5e functions.

Install

With a correctly configured Go toolchain:

1go get -u go.anx.io/e5e/v2

Getting started

 1package main
 2
 3import (
 4	"context"
 5	
 6	"go.anx.io/e5e/v2"
 7)
 8
 9type SumData struct {
10	A int `json:"a"`
11	B int `json:"b"`
12}
13
14func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
15	result := r.Data().A + r.Data().B
16	return &e5e.Result{
17		Status: 200,
18		ResponseHeaders: map[string]string{
19			"x-custom-response-header": "This is a custom response header",
20		},
21		Data: result,
22	}, nil
23}
24
25func main() {
26	e5e.AddHandlerFunc("Sum", Sum)
27	e5e.Start(context.Background())
28}
29

List of developers