Added robots.txt file and its handler.
This commit is contained in:
parent
5f419d7dd8
commit
8925f2ce24
@ -84,6 +84,7 @@ func main() {
|
||||
srv := http.NewHttpServer()
|
||||
|
||||
srv.SetNotFoundHandler(hand.NotFound)
|
||||
srv.GET("/robots.txt", hand.RobotsTxt)
|
||||
srv.ServeStatic("/assets/*filepath", hand.AssetsFS())
|
||||
srv.GET("/", hand.Index)
|
||||
srv.POST("/", hand.Upload)
|
||||
|
@ -220,3 +220,8 @@ func (h *UploadHandlers) NotFound(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "deleted")
|
||||
}
|
||||
}
|
||||
|
||||
func (h *UploadHandlers) RobotsTxt(w http.ResponseWriter, r *http.Request) {
|
||||
data, _ := web.AssetsGetFile("robots.txt")
|
||||
w.Write(data)
|
||||
}
|
||||
|
2
web/assets/robots.txt
Normal file
2
web/assets/robots.txt
Normal file
@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow: /assets/
|
Loading…
Reference in New Issue
Block a user