fgweb

package module
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: GPL-3.0 Imports: 14 Imported by: 4

README

Fgta Web Framework

  • Template Engine
  • Content Management
  • tambah

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRequestHandler added in v1.2.2

func CreateRequestHandler(hnd RouteHandlerFunc) *chi.Mux

func CreateServer added in v1.2.2

func CreateServer(port int, hnd RouteHandlerFunc) *http.Server

func Get

func Get(mux *chi.Mux, pattern string, fn http.HandlerFunc)

Get registers a route handler function for the given pattern in the chi.Mux router.

Parameters:

  • mux: The chi.Mux router to register the route handler on.
  • pattern: The URL pattern for the route.
  • fn: The route handler function that will handle incoming requests.

Returns: None.

func GetCfgContent added in v1.2.2

func GetCfgContent() *[]byte

func New

func New(rootDir string, cfgpath string) (*appsmodel.Webservice, error)

New initializes a new instance of the Webservice struct.

Parameters: - rootDir: the root directory of the webservice. - cfgpath: the path to the configuration file.

Returns: - *appsmodel.Webservice: a pointer to the initialized Webservice struct. - error: an error if there was a problem reading the configuration file or preparing the template.

func Post

func Post(mux *chi.Mux, pattern string, fn http.HandlerFunc)

Post registers a route handler function for the given pattern in the chi.Mux router.

Parameters: - mux: The chi.Mux router to register the route handler on. - pattern: The URL pattern for the route. - fn: The route handler function that will handle incoming requests.

func PrepareTemplate

func PrepareTemplate(ws *appsmodel.Webservice) error

PrepareTemplate prepares the template for the given webservice.

Parameters: - ws: The webservice for which the template needs to be prepared.

Returns: - error: An error if the template preparation fails.

func StartService

func StartService(port int, hnd RouteHandlerFunc) (err error)

StartService starts the web service on the specified port and handles incoming requests using the provided RouteHandlerFunc.

Parameters: - port: the port number on which the service should be started. - hnd: the RouteHandlerFunc that will handle incoming requests.

Returns: - err: an error if there was a problem starting the service.

Types

type RouteHandlerFunc

type RouteHandlerFunc func(mux *chi.Mux) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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