static

package
v0.0.0-...-fb65882 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: MIT Imports: 12 Imported by: 1

README

Static

The static pkg allows for testing of crawling for both manual and integration testing.

API

The API type uses the http.FileServer to enable serving of static files over a http request.

The static.go file contains the files from the /templates folder, that can be either served locally for development or encoded into the actual .go file so when the cli is built it contains the templates for use.

The filesys.go is a middleware that sits in between API type and static.go file system. The aim of the middleware is to allow the rendering of template files so it makes it easier to generate lots of files with ease. It can be configured to generate 100s and 1000s of template files to fully push the crawler if required.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TemplateFS

func TemplateFS(useLocal bool, logger log.Logger) http.FileSystem

TemplateFS returns a http.FileSystem for embedded assets and templates. This filesystem wraps the `github.com/mjibson/esc` API to provide a way to quickly load templates from the local file system and also use embedded files within the binary once packaged. If useLocal is true, the filesystem's content are used instead.

Types

type API

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

API serves the static API.

func NewAPI

func NewAPI(local bool, logger log.Logger) *API

NewAPI returns a usable API for static templating content.

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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