Duck is a simple but powerful package for learning how to write modular web applications/services in Golang.
Notice: Duck is still in the design stage. It's not working yet. Stay tuned.
After installing Go and setting up your GOPATH, and then
go get github.com/zddhub/duck
You can use Duck like this:
package main
import "github.com/zddhub/duck"
func main() {
d := duck.Incubate()
d.Get("/", func() string {
return "Hello world!"
})
d.Run()
}
Then run your server:
You will now have a Duck webserver running on localhost:3030
You can run more complex case:
go run main/main.go
You can read the follow blog to learn more:
Inspired by Martini