I hereby claim:
- I am ant0ine on github.
- I am ant0ine (https://keybase.io/ant0ine) on keybase.
- I have a public key whose fingerprint is 69E7 0047 A416 8EC6 047B 7074 DBA8 D773 1031 4327
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#GithubAPI Routes: 203 | |
Ace: 54072 Bytes | |
Bear: 84024 Bytes | |
Beego: 165000 Bytes | |
Bone: 92960 Bytes | |
Denco: 37016 Bytes | |
Gin: 60496 Bytes | |
GocraftWeb: 89048 Bytes | |
Goji: 50568 Bytes | |
GoJsonRest: 134552 Bytes |
package main | |
import ( | |
"github.com/ant0ine/go-json-rest/rest" | |
"log" | |
"net/http" | |
) | |
// Trying different kind of API for the v3 |
/* | |
Trying to make wrapped handlers work together | |
Basically some Handers have GetSomething methods, | |
some others have ProvideSomething methods, | |
At the wiring step, you provide to some handlers what you get from others. | |
*/ | |
package main |
type Middleware interface { | |
WrapHandler(*http.Handler) *http.Handler | |
} | |
func NewMiddlewareRunnerHandler(middlewares []*Middleware, handler *http.Handler) *http.Handler { | |
current := handler | |
for _, middleware := range middlewares { | |
current = middleware.WrapHandler(current) | |
} | |
return current |
// Serve files that never change | |
// | |
// If you can put a version string (commitish for instance) in the path of your | |
// static files, then the content served by the corresponding URLs is guaranteed | |
// to never change. A whole set of optimisations become possible. | |
// | |
// * Set the Expires and Last-Modified headers to +100 years | |
// * Set the Cache-Control header to "public; max-age=<+100 years>; s-maxage=<+100 years>" | |
// * Set the Etag header to the full file path ? | |
// * If the request contains If-Modified-Since, return 304 without checking anything |