Skip to content

venliong/webby

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
December 14, 2012 21:26
December 14, 2012 21:26
December 14, 2012 21:26
March 14, 2013 18:53
March 9, 2013 11:52
March 11, 2013 12:16
March 9, 2013 11:52
March 11, 2013 16:26
March 9, 2013 11:52

Webby

A Very Nice Web Framework that can be used as a standalone or a embeddable solution for existing Go project that require a Web Interface!

It's built on top of the standard package 'net/http'!

Installation

go get github.com/CJ-Jackson/webby

Example Web Application

package main

import (
	"code.google.com/p/go.net/websocket"
	"github.com/CJ-Jackson/webby"
	"io"
)

func EchoServer(ws *websocket.Conn) {
	io.Copy(ws, ws)
}

type index struct{}

func (_ index) View(w *webby.Web) {
	page := w.Param.GetInt("page")

	if page <= 0 {
		page = 1
	}

	w.Print("<h1>Hello World!</h1>\r\n")
	w.Print("Page: ", page, "\r\n")
}

func init() {
	index_junc := webby.Junction{
		WS:  webby.HttpRouteHandler{websocket.Handler(EchoServer)},
		ALL: index{},
	}

	webby.Route.RegisterHandlerMap(webby.RouteHandlerMap{
		"^/$": index_junc,
		"^/(?P<page>\\d+)/?$": index_junc,
	})
}

func main() {
	webby.Check(webby.StartHttp(":8080"))
}

Note: This example require websocket library installed; The framework itself can live without that.

go get code.google.com/p/go.net/websocket

Documentation

Documentation are avaliable at

http://go.pkgdoc.org/github.com/CJ-Jackson/webby

Note

Note this framework does not have an ORM but can co-exist with an ORM Framework, a Google App Engine user probably won't need an ORM Framework!

About

Simple Web Application Server Framework!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published