Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yosssi committed Feb 25, 2014
1 parent 1421952 commit 311e99c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,32 @@ becomes
</body>
</html>
```

## Implementation Example

```go
package main

import (
"github.com/yosssi/gold"
"net/http"
)

var g = gold.NewGenerator(false)

func handler(w http.ResponseWriter, r *http.Request) {
tpl, err := g.ParseFile("./top.gold")
if err != nil {
panic(err)
}
data := map[string]interface{}{"Title": "Gold"}
if err := tpl.Execute(w, data); err != nil {
panic(err)
}
}

func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
```

0 comments on commit 311e99c

Please sign in to comment.