httpserv

package module
v0.0.0-...-26f0a2d Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 5 Imported by: 0

README

Advanced Computing Lab's Golang based http/https server.

Usage:

Creating http server:
http_server := aclabs_httpserv.NewHttpServ(httpPort, homeDirectoryForWebsite, httpRequestHandler)
Creating https server:
https_server := aclabs_httpserv.NewHttpServTLS(httpPort, homeDirectoryForWebsite, httpRequestHandler, certFile, keyFile)
Closing server:
http_server.Shutdown()

TODO:

  • Test cases.
  • Server error callback handler.
  • Passing app's logger.
  • Add example.
  • Add tutorial to create ssl cert.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpServer

type HttpServer struct {
	// contains filtered or unexported fields
}

func NewHttpServ

func NewHttpServ(port int, root_dir string, request_handler_fptr func(http.ResponseWriter, *http.Request)) *HttpServer

func NewHttpServTLS

func NewHttpServTLS(port int, root_dir string, request_handler_fptr func(http.ResponseWriter, *http.Request), certFile string, keyFile string) *HttpServer

func (*HttpServer) GetPort

func (t *HttpServer) GetPort() int

func (HttpServer) IsInitialized

func (t HttpServer) IsInitialized() (bool, error)

func (*HttpServer) Shutdown

func (t *HttpServer) Shutdown()

func (HttpServer) StartedForTLS

func (t HttpServer) StartedForTLS() bool

Function doesn't guarantee server is running for tls but shows if server was started with NewHttpServTLS; it fallbacks to the default behavior of go's http tls procedure.

Jump to

Keyboard shortcuts

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