Skip to content

Functions

Taubyte HTTPS functions compile Go to WASM and attach to a domain path.

Skeleton

package lib

import "github.com/taubyte/go-sdk/event"

//export ApiHealth
func ApiHealth(e event.Event) uint32 {
    h, err := e.HTTP()
    if err != nil {
        return 1
    }
    h.Headers().Set("Content-Type", "application/json")
    h.Headers().Set("Access-Control-Allow-Origin", "*")
    h.Write([]byte(`{"ok":true}`))
    h.Return(200)
    return 0
}

Ordering rule

Always: Headers → Write → Return(status).

App scope

If the function opens a database, create it under an application and keep code at code/app/functions/<name>/ on remote builders (not code/applications/app/...).

This kit’s functions

Method Path Call
GET /api/health ApiHealth
GET /api/versions ApiVersions
POST /api/feedback PostFeedback
GET /api/feedback ListFeedback