Created
April 7, 2014 19:03
-
-
Save twmulloy/7dc7f38c2006fe2aea6d to your computer and use it in GitHub Desktop.
spa catch-all Go app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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