Skip to content

Instantly share code, notes, and snippets.

@suminb
Created March 29, 2017 17:56
Show Gist options
  • Save suminb/1417be6ebfc9f22ca20edf6d6281db91 to your computer and use it in GitHub Desktop.
Save suminb/1417be6ebfc9f22ca20edf6d6281db91 to your computer and use it in GitHub Desktop.
Golang Practice
<!-- This file must be under `templates` directory -->
<h1>Hello World!</h1>
<div>{{.}}</div>
<div>{{ .key }}</div>
package main
import "github.com/go-martini/martini"
import "github.com/martini-contrib/render"
func main() {
m := martini.Classic()
m.Use(render.Renderer())
m.Get("/", func() string {
return "Hello world!"
})
m.Get("/test", func() (int, string) {
return 404, "NotFound"
})
m.Get("/template", func(r render.Render) {
r.HTML(200, "index", map[string]interface{}{"key": "value"})
})
m.Run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment