top

Package render is a middleware for Martini that provides easy JSON serialization and HTML template rendering.

package main

import (
  "github.com/go-martini/martini"
  "github.com/martini-contrib/render"
)

func main() {
  m := martini.Classic()
  m.Use(render.Renderer()) // reads "templates" directory by default

  m.Get("/html", func(r render.Render) {
    r.HTML(200, "mytemplate", nil)
  })

  m.Get("/json", func(r render.Render) {
    r.JSON(200, "hello world")
  })

  m.Run()
}

Imported by 1 package(s)

  1. github.com/JasonSoft/ThinkStore

Imports 1 package(s)

  1. github.com/go-martini/martini