Skip to content

Instantly share code, notes, and snippets.

@twmulloy
Created April 7, 2014 19:03
Show Gist options
  • Save twmulloy/7dc7f38c2006fe2aea6d to your computer and use it in GitHub Desktop.
Save twmulloy/7dc7f38c2006fe2aea6d to your computer and use it in GitHub Desktop.
spa catch-all Go app
package main
import (
"html/template"
"net/http"
)
var layout = template.Must(template.ParseGlob("layouts/base.html"))
func init() {
http.HandleFunc("/", app)
}
func app(w http.ResponseWriter, r *http.Request) {
data := make(map[string]interface{})
if err := layout.Execute(w, data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment