Documentation ¶
Overview ¶
Package frontend provides the routing and middleware for the web app
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ParseTemplates = func() { templates = make(map[string]*template.Template) templates["search"] = template.Must( template.New("base.html"). Funcs(funcMap). ParseFiles( "templates/base.html", "templates/main.css", "templates/search.html", ), ) }
ParseTemplates parses our html templates.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { Q string `json:"query"` L string `json:"-"` R string `json:"-"` N string `json:"-"` Preferred []language.Tag `json:"-"` Region language.Region `json:"-"` Number int `json:"-"` Page int `json:"-"` }
Context holds a user's request context so we can pass it to our template's form. Query, Language, and Region are the RAW query string variables.
type Frontend ¶
type Frontend struct { Document *bangs.Bangs Suggest suggest.Suggester Search search.Fetcher Wikipedia Vote vote.Voter }
Frontend holds settings for our languages supported, backend, etc. better name???
Click to show internal directories.
Click to hide internal directories.