Documentation
¶
Overview ¶
Serving resource from zip file appended to Go executable (this enables on file deploy).
Making it happen:
- Add code to serve resources (see example below)
- Compile your executable
- Run the `gotogether` script from https://github.com/carbocation/gotogether/src
- Deploy
Example code:
package main
import (
"fmt"
"net/http"
"os"
"github.com/carbocation/gotogether"
)
type params struct {
Number int
}
func indexHandler(w http.ResponseWriter, req *http.Request) {
t, err := gotogether.LoadTemplates(nil, "t.html")
if err != nil {
http.NotFound(w, req)
}
if err = t.Execute(w, params{7}); err != nil {
http.NotFound(w, req)
}
}
func main() {
gotogether.Handle("/static/")
http.HandleFunc("/", indexHandler)
if err := http.ListenAndServe(":8080", nil); err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
os.Exit(1)
}
}
Index ¶
Constants ¶
View Source
const (
Version = "0.3.2"
)
Variables ¶
View Source
var ResourceMap map[string]Resource = nil
Functions ¶
func Initialize ¶
func Initialize() error
Types ¶
Click to show internal directories.
Click to hide internal directories.