functions

package
v0.6.14 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Function

type Function struct {
	Route   string
	File    fs.FileInfo
	Path    string
	Handler func(http.ResponseWriter, *http.Request)
	Base    string

	//	File location where built package is stored
	Build string

	ServerConfig string
	Plugin       *plugin.Plugin
	// contains filtered or unexported fields
}

func (*Function) BuildGoPlugin

func (function *Function) BuildGoPlugin() (*plugin.Plugin, error)

func (*Function) BuildNodePackage

func (function *Function) BuildNodePackage() error

func (*Function) BuildNodeServer

func (function *Function) BuildNodeServer(port int) error

func (*Function) Prepare

func (function *Function) Prepare() error

type Server

type Server struct {

	//	It's inherently an HTTP server under the hood.
	*http.Server
	// contains filtered or unexported fields
}

Functions Server

The server will read environment variables on runtime from the attached environment, if any. And the environment variables in the locally saved .env.development file.

func New

func New(config *ServerConfig) *Server

Intializes and returns a new functions server.

func (*Server) FunctionHandler

func (s *Server) FunctionHandler(w http.ResponseWriter, r *http.Request)

Main handler function that will handle all our incoming requests.

type ServerConfig

type ServerConfig struct {

	//	Base route on which the handle function should listen to.
	//	If not supplied, "/" is chosen by default.
	Handle string

	//	(Optional) Environment to attach to this server.
	Environment *environment.Environment

	//	Port on which to run the server
	Port string

	//	Overwrite the list of any files to avoid during path/tree walking.
	//	If left empty, the default list of files to avoid will be used.
	FilesToAvoid []string

	//	Directory where NodeJS functions must be built.
	//	This must be the location where node_modules exists.
	//	If left empty, the default Nhost working directory is used.
	BuildDir string

	//	Server specific logger.
	//	In nil, then common Nhost logger is used.
	Log *logrus.Logger

	Mux *http.ServeMux
}

Server configuration that the user can decide to load inside the functions server.

Jump to

Keyboard shortcuts

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