host

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host struct {
	// Host name
	Name string
	// Main directory
	DocumentRoot string
	// Main path
	Path string
	// Settings
	Settings *dig.InterfaceMap
	// Template
	TemplateGroup *template.Template
	// Lock for template
	*sync.RWMutex
	// Function map for template.
	template.FuncMap
	// Standard request.
	*http.Request
	// Standard response writer.
	http.ResponseWriter

	// File watcher
	Watcher *fsnotify.Watcher
	// Template root
	TemplateRoot string
	// contains filtered or unexported fields
}

Host is the struct that represents virtual hosts.

func New

func New(name string, root string) (*Host, error)

New creates and returns a host.

func (*Host) Close

func (host *Host) Close()

Close removes the watcher that is currently associated with the host.

func (*Host) GetContentPath

func (host *Host) GetContentPath() (string, error)

GetContentPath provides the relative path to site content

func (*Host) GetIndexPath added in v0.9.3

func (host *Host) GetIndexPath() (string, error)

GetIndexPath returns the absolute path to the search index for a host.

func (*Host) Search

func (host *Host) Search(terms []string, res int) []fulltext.SearchResultItem

Search returns the results of a fulltext search on terms.

func (*Host) ServeHTTP

func (host *Host) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP reads a request and creates an appropriate response.

Jump to

Keyboard shortcuts

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