Exemple #1
0
func main() {
	cl := controller.NewController()

	cl.BeforeAction(beforeAction)
	cl.AfterAction(afterAction)

	cl.ExactMatchAction("/exact", exactAction)
	cl.RegexMatchAction("^/[a-z]+([0-9]+)", regexAction)

	gracehttp.ListenAndServe(":8001", cl)
}
Exemple #2
0
func main() {
	cl := controller.NewController()

	cl.AddBeforeAction("^/exact", beforeAction).
		AddAfterAction("^/([a-z]+)[0-9]+", afterAction).
		AddExactMatchAction("/exact", exactAction).
		AddExactMatchAction("/redirect", redirectAction).
		AddRegexMatchAction("^/[a-z]+([0-9]+)", regexAction).
		AddDestructFunc("^/([a-z]+)[0-9]+", destruct)

	gracehttp.ListenAndServe(":8001", cl)
}