Open xpbliss opened 8 years ago
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.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.flash
controller. I'll implement it today or tomorrow.
Neither compression nor cache controllers have been added yet, too.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+.
1.When visit the static page ,such as
http://localhost:8080/static/index.html
,It still execute theController
's AllInitially()
andBefore()
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
andRenderFile
methods.3.Have a flash function like
revel
'sflash
function? and thecompressionTypes
,cache
.....?4.https? http2?