Merge pull request #770 from msteinert/robots-txt

Serve `robots.txt` from `/`
This commit is contained in:
Brad Rydzewski 2014-12-27 12:45:48 -08:00
commit 55967e1f32
2 changed files with 2 additions and 1 deletions

View file

@ -137,6 +137,7 @@ func main() {
// create handler for static resources // create handler for static resources
assets := rice.MustFindBox("app").HTTPBox() assets := rice.MustFindBox("app").HTTPBox()
assetserve := http.FileServer(rice.MustFindBox("app").HTTPBox()) assetserve := http.FileServer(rice.MustFindBox("app").HTTPBox())
http.Handle("/robots.txt", assetserve)
http.Handle("/static/", http.StripPrefix("/static", assetserve)) http.Handle("/static/", http.StripPrefix("/static", assetserve))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write(assets.MustBytes("index.html")) w.Write(assets.MustBytes("index.html"))