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) BuildNodePackage ¶
func (*Function) BuildNodeServer ¶
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 (*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.
Click to show internal directories.
Click to hide internal directories.