Documentation
¶
Index ¶
Constants ¶
const ( // KeyHost is the configuration key for the host. KeyHost string = "host" // KeyPort is the configuration key for the port. KeyPort string = "port" // KeyStaticDir is the configuration key to know where // static assets are stored (in case we want to serve them // from this application instead of using a third party // web server). KeyStaticDir string = "staticdir" // KeyHTMLTemplatesDir is the directory where the HTML templates // are stored. KeyHTMLTemplatesDir string = "HTMLtemplates" )
Variables ¶
This section is empty.
Functions ¶
func NewMultiRenderEngine ¶
func NewMultiRenderEngine(t *Templates) render.HTMLRender
NewMultiRenderEngine creates a render engine from the Templates struct. Currently, it only provides a `trans` function to templates to be able to translate content.
func NewMultiRenderEngineFromDirs ¶
func NewMultiRenderEngineFromDirs(dirPaths ...string) render.HTMLRender
NewMultiRenderEngineFromDirs scan a list of directories to search for templates under directories named `html_templates` (and template fragments under `html_templates/inc` dirs).
Types ¶
type Config ¶
type Config struct { Port int Host string HTMLTemplatesDir string ServeStatic bool StaticDir string }
Config contains the information about a web service to run.
func NewDefaultConfig ¶
NewDefaultConfig creates the default configuration for a service to run.
type HTMLWrapper ¶
type HTMLWrapper struct {
// contains filtered or unexported fields
}
HTMLWrapper is a "dumb" wrapper over the multitemplate implementation, that on every request reloads the templates: so it should not be used in production, but is useful to use it while developing, to have live updates from the loaded templates.