https://github.com/walkr/gower
A tiny go framework
https://github.com/walkr/gower
Last synced: 3 months ago
JSON representation
A tiny go framework
- Host: GitHub
- URL: https://github.com/walkr/gower
- Owner: walkr
- Created: 2014-09-15T00:10:51.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-09-15T00:21:04.000Z (almost 11 years ago)
- Last Synced: 2023-08-03T21:23:05.724Z (almost 2 years ago)
- Language: Go
- Size: 121 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
gower
=====
a tiny Go frameworkUsage
-----
```gopackage main
import (
"github.com/walkr/gower"
)// Simple Hello World
func hello(c *gower.Context){
c.Write("Hello World")
}// Read the name from url and output a template
func sayHi(c *gower.Context){
data := map[string]interface{}{"name":c.Matches[1]}
// Template location "www/templates/say-hi.html"
c.WriteTemplate("say-hi.html", data)
}// Display some server stats
func serverStats(c *gower.Context){
c.WriteJson(gower.ServerStat)
}func main(){
// Register the routes
gower.Get("/hello", hello)
gower.Get("/say-hi/([a-zA-Z]+)", sayHi)
gower.Get("/stats", serverStats)
// Start the server
gower.Start()}
```
```bash
# Start app
./bin/app# Start on a different port and enable debug
./bin/app --port=9000 --debug=true```
MIT License