Example #1
0
func New() Server {
	// load config
	//config.Load()
	if config.CookieExpires {
		Wrap = wrapExpires
		views.CanEdit = canEditExpire
	} else {
		// secure editable views
		views.CanEdit = canEdit
	}

	// update empty template
	//views.EmptyTmpl = template.Empty

	// editable view media
	views.CodeMirrorJS = "//" + config.MediaURL + "js/vendor/codemirror.js"
	views.CodeMirrorCSS = "//" + config.MediaURL + "css/codemirror.css"

	// add all XXX.html, http status-code, templates
	addErrViews(config.TmplPath)

	// create the handler
	h, e := dingoHandler()
	if e != nil {
		log.Fatalf("Failed to create socket: %v", e)
	}
	s := dingo.New(h)

	// add the editable route
	s.ReRoute(config.TmplEditRt, views.EditHandler, "GET", "POST")

	// set a default error handler
	dingo.ErrorHandler = Error

	// set `users` factory
	Users = users.New()

	// return the server so that routes can be added
	return Server{&s, Wrap}
}
Example #2
0
File: gae.go Project: juztin/dingo
func Server() GAEServer {
	return GAEServer{dingo.New(nil)}
}