Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.59 KB

README.md

File metadata and controls

63 lines (45 loc) · 1.59 KB

go-e5e

PkgGoDev Build Status Test Coverage Go Report Card

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

Install

With a correctly configured Go toolchain:

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

Getting started

package main

import (
	"context"
	
	"go.anx.io/e5e/v2"
)

type SumData struct {
	A int `json:"a"`
	B int `json:"b"`
}

func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
	result := r.Data().A + r.Data().B
	return &e5e.Result{
		Status: 200,
		ResponseHeaders: map[string]string{
			"x-custom-response-header": "This is a custom response header",
		},
		Data: result,
	}, nil
}

func main() {
	e5e.AddHandlerFunc("Sum", Sum)
	e5e.Start(context.Background())
}

List of developers

Links