faasify

module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT

README

faasify - A framework for building a simple and blazingly fast FaaS server from scratch

Compile the server with a security token

./scripts/compile.sh

Run the server

FAASIFY_ADDESS=":3000" FAASIFY_URL="http://127.0.0.1:3000" ./build/server

Call a function with curl and security token

curl -H "Authorization: Bearer $(cat ./security/token)" http://127.0.0.1:3000/status

Call a function with faasify client and buildin token

./build/client -host http://127.0.0.1:3000 -name status

Display the demo page

http://127.0.0.1:3000/index

Add functions

Create a new function named YOUR_FUNCTION:

mkdir ./functions/YOUR_FUNCTION

Add a function named HandlerFunc() like the follow:

vim ./functions/YOUR_FUNCTION/handler.go

package YOUR_FUNCTION

import "net/http"

func HandlerFunc() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("OK"))
	}
}

The function routing gets updated on compile time, based on the contents of the functions directory.

Directories

Path Synopsis
cmd
internal
http/server
Code generated by fassify DO NOT EDIT
Code generated by fassify DO NOT EDIT
pkg

Jump to

Keyboard shortcuts

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