Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
martini simple server
package main
import (
"github.com/go-martini/martini"
"github.com/martini-contrib/render"
"runtime"
)
type myClassic struct {
*martini.Martini
martini.Router
}
func withoutLogging() *myClassic {
r := martini.NewRouter()
m := martini.New()
m.Use(martini.Recovery())
m.Use(martini.Static("public"))
m.MapTo(r, (*martini.Routes)(nil))
m.Action(r.Handle)
return &myClassic{m, r}
}
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
m := withoutLogging()
martini.Env = martini.Prod
m.Use(render.Renderer())
m.Get("/", func(r render.Render) {
r.HTML(200, "hello", "jeremy")
})
m.Run()
}
<h2>Hello {{.}}!</h2>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment