Goji is a minimalistic web framework inspired by Sinatra. Godoc.
package main
import (
"fmt"
"net/http"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
)
func hello(c web.C, w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %s!", c.UrlParams["name"])
}
func main() {
goji.Get("/hello/:name", hello)
goji.Serve()
}
Goji also includes a sample application in the example
folder which
was artificially constructed to show off all of Goji's features. Check it out!
- Compatible with
net/http
- URL patterns (both Sinatra style
/foo/:bar
patterns and regular expressions) - Reconfigurable middleware stack
- Context/environment objects threaded through middleware and handlers
- Automatic support for Einhorn, systemd, and more
- Graceful shutdown, and zero-downtime graceful reload when combined with Einhorn.
- Ruby on Rails / jQuery style parameter parsing