server

package
v0.0.0-...-9fc8000 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAPIRoutesHandler

func AddAPIRoutesHandler(r *mux.Router, path string, appCtx *api.AppContext, cfg *config.Config) error

func AddHealthCheckHandler

func AddHealthCheckHandler(r *mux.Router, path string, db *sql.DB)

func Run

func Run()

func ServeSinglePageApplication

func ServeSinglePageApplication(r *mux.Router, path string, appDir string)

Types

type SPAHandler

type SPAHandler struct {
	ServingPath string
	StaticPath  string
	IndexPath   string
}

SPAHandler implements the http.Handler interface. The path to the static directory and path to the index file within that static directory are used to serve the SPA in the given static directory.

func NewSinglePageApplicationHandler

func NewSinglePageApplicationHandler(servingPath, appDir string) SPAHandler

func (SPAHandler) ServeHTTP

func (h SPAHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP inspects the URL path to locate a file within the static dir on the SPA handler. If a file is found, it will be served. If not, the file located at the index path on the SPA handler will be served

Jump to

Keyboard shortcuts

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