openfaas / golang-http-template

Golang templates for OpenFaaS using HTTP extensions
https://www.openfaas.com/
MIT License
106 stars 57 forks source link

Move to using templates-sdk repo for http function #44

Closed alexellis closed 4 years ago

alexellis commented 4 years ago

Signed-off-by: Alex Ellis (OpenFaaS Ltd) alexellis2@gmail.com

Description

Move to using templates-sdk repo for http function

The HTTP function now makes use of a dedicated repository for SDK resources in the openfaas org.

How Has This Been Tested?

e2e testing with a newly created function on my kind cluster, then I changed the code and ran faas up to see the change reflect.

package function

import (
    "fmt"
    "net/http"

    handler "github.com/openfaas/templates-sdk/go-http"
)

// Handle a function invocation
func Handle(req handler.Request) (handler.Response, error) {
    var err error

    message := fmt.Sprintf("hallo alex, input was: %s", string(req.Body))

    return handler.Response{
        Body:       []byte(message),
        StatusCode: http.StatusOK,
    }, err
}

How are existing users impacted? What migration steps/scripts do we need?

I don't believe that they are affected, the previous repo still exists that held the go function SDK, but is archived.