goaltools / goal

Goal is a toolkit for high productivity web development in Go language in the spirit of Revel Framework that is built around the concept of code generation.
BSD 2-Clause "Simplified" License
87 stars 3 forks source link

Add some more functions? #38

Open xpbliss opened 8 years ago

xpbliss commented 8 years ago

1.When visit the static page ,such as http://localhost:8080/static/index.html,It still execute the Controller's All Initially() and Before() function? if visit the static page ,it will execute these function many time,because the index.htm include some css and js and jpg? Maybe another usage is that we can intercept the static file. Maybe should make a switch for it?

the route for static is: r.Get("/static/*filepath", http.StripPrefix("/static/", http.FileServer(http.Dir("./static")), ).ServeHTTP),

2.There are still not RenderXML and RenderFile methods.

3.Have a flash function like revel's flash function? and the compressionTypes,cache.....?

4.https? http2?

ghost commented 8 years ago
  1. No. http.StripPrefix("/static/", http.FileServer(http.Dir("./static")) is not an action but a set of functions from standard library. That's why neither Initially nor Before will be started when serving a static page or some other static assets.
  2. I have added xml. Now need to create a files controller with the analogues of Revel's RenderFile and RenderBinary. Plus, a controller with Redirect, RenderNotFound, RenderError, RenderToDo, RenderForbidden would be helpful. At some point I'll implement all of this. BTW, PRs to colegion/contrib repo are welcome.
  3. There is no flash controller. I'll implement it today or tomorrow. Neither compression nor cache controllers have been added yet, too.
  4. HTTPS is supported. Update server/server.go:
import (
    ...
+   "crypto/tls"
)
...
func Start(configFiles ...string) error {
    ...
    s := &http.Server{
        Addr:    *addr,
        Handler: h,
+       TLSConfig: &tls.Config{
+           ...
+       }
    }
    ...
}

As for the HTTP2, it's already there is you're using Go1.6+.