GoEngine Boilerplate is combination of serveral different repositories, some made for Go some not.
The project is built using routes.go for Sinatra/ExpressJS style routing on the Google App Engine PaaS. HTML Structure and design using h5bp and Twitter Bootstrap. Javascript templating is done with mustache.js, but has not been baked into requireJS. The javascript component incorporates RequireJS for dependency management.
mustache.js has been converted to use [[ ]] as delimiters so it can play nice with golang's html/template package.
There is currently (1.7.0) an issue with passing routes with spaces on the App Engine dev_appserver.py. The issue does not seem to exist on the live server. We have found that making a small change to /google/appengine/ext/go/init.py will resolve this issue.
Remove from line 513:
request_uri = env['PATH_INFO']
Replace with:
request_uri = env['_AH_ENCODED_SCRIPT_NAME']
Alex Ninneman
Jessica Janiuk
HTML5 Boilerplate is a professional front-end template that helps you build fast, robust, adaptable, and future-proof websites. Spend more time developing and less time reinventing the wheel.
This project is the product of many years of iterative development and combined community knowledge. It does not impose a specific development philosophy or framework, so you're free to architect your code in the way that you want.
Clone the git repo - git clone git://github.com/h5bp/html5-boilerplate.git
- or download it
- HTML5 ready. Use the new elements with confidence.
- Cross-browser compatible (Chrome, Opera, Safari, Firefox 3.6+, IE6+).
- Designed with progressive enhancement in mind.
- CSS normalizations and common bug fixes.
- IE-specific classes for easier cross-browser control.
- A default print stylesheet, performance optimized.
- Mobile browser optimizations.
- Protection against any stray
console.log
causing JavaScript errors in IE6/7. - The latest jQuery via CDN, with a local fallback.
- A custom Modernizr build for feature detection.
- An optimized Google Analytics snippet.
- Apache server caching, compression, and other configuration defaults for Grade-A performance.
- Cross-domain Ajax and Flash.
- "Delete-key friendly." Easy to strip out parts you don't need.
- Extensive inline and accompanying documentation.
Anyone and everyone is welcome to contribute. Hundreds of developers have helped make the HTML5 Boilerplate what it is today.
- Source: http://github.com/h5bp/html5-boilerplate
- Web: http://html5boilerplate.com
- Docs: http://html5boilerplate.com/docs
- Twitter: http://twitter.com/h5bp
- jQuery: MIT/GPL license
- Modernizr: MIT/BSD license
- Normalize.css: Public Domain
The Unlicense (aka: public domain)
Bootstrap provides simple and flexible HTML, CSS, and Javascript for popular user interface components and interactions. In other words, it's a front-end toolkit for faster, more beautiful web development. It's created and maintained by Mark Otto and Jacob Thornton at Twitter.
To get started, checkout http://twitter.github.com/bootstrap!
Clone the repo, git clone git://github.com/twitter/bootstrap.git
, or download the latest release.
For transparency and insight into our release cycle, and for striving to maintain backward compatibility, Bootstrap will be maintained under the Semantic Versioning guidelines as much as possible.
Releases will be numbered with the follow format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bumps the patch
For more information on SemVer, please visit http://semver.org/.
Have a bug? Please create an issue here on GitHub! Also, when filing please make sure you're familiar with necolas's guidelines. thanks! <3
https://github.com/twitter/bootstrap/issues
Keep up to date on announcements and more by following Bootstrap on Twitter, @TwBootstrap.
Read more detailed announcements, discussions, and more on The Official Twitter Bootstrap Blog.
Have a question? Ask on our mailing list!
twitter-bootstrap@googlegroups.com
http://groups.google.com/group/twitter-bootstrap
Server: irc.freenode.net
Channel: ##twitter-bootstrap (the double ## is not a typo)
We have included a makefile with convenience methods for working with the Bootstrap library.
- dependencies Our makefile depends on you having recess, uglify.js, and jshint installed. To install, just run the following command in npm:
$ npm install recess uglify-js jshint -g
-
build -
make
Runs the recess compiler to rebuild the/less
files and compiles the docs pages. Requires recess and uglify-js. Read more in our docs » -
test -
make test
Runs jshint and qunit tests headlessly in phantom js (used for ci). Depends on having phatomjs installed. -
watch -
make watch
This is a convenience method for watching just Less files and automatically building them whenever you save. Requires the Watchr gem.
Please make all pull requests against wip-* branches. Also, if your unit test contains javascript patches or features - you must include relevant unit tests. Thanks!
Mark Otto
Jacob Thornton
Copyright 2012 Twitter, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
a simple http routing API for the Go programming language
go get github.com/bradrydzewski/routes
this project combines the best of web.go
and pat.go
. It uses pat.go
's named url parameters (ie :param
) and web.go
's regular expression groups for url matching and parameter extraction, which provides significant performance improvements.
for more information see: http://gopkgdoc.appspot.com/pkg/github.com/bradrydzewski/routes
package main
import (
"fmt"
"github.com/bradrydzewski/routes"
"net/http"
)
func Whoami(w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
lastName := params.Get(":last")
firstName := params.Get(":first")
fmt.Fprintf(w, "you are %s %s", firstName, lastName)
}
func main() {
mux := routes.New()
mux.Get("/:last/:first", Whoami)
http.Handle("/", mux)
http.ListenAndServe(":8088", nil)
}
You can create routes for all http methods:
mux.Get("/:param", handler)
mux.Put("/:param", handler)
mux.Post("/:param", handler)
mux.Patch("/:param", handler)
mux.Del("/:param", handler)
You can specify custom regular expressions for routes:
mux.Get("/files/:param(.+)", handler)
You can also create routes for static files:
pwd, _ := os.Getwd()
mux.Static("/static", pwd)
this will serve any files in /static
, including files in subdirectories. For example /static/logo.gif
or /static/style/main.css
.
You can use helper functions for serializing to Json and Xml. I found myself constantly writing code to serialize, set content type, content length, etc. Feel free to use these functions to eliminate redundant code in your app.
Helper function for serving Json, sets content type to application/json
:
func handler(w http.ResponseWriter, r *http.Request) {
mystruct := { ... }
routes.ServeJson(w, &mystruct)
}
Helper function for serving Xml, sets content type to application/xml
:
func handler(w http.ResponseWriter, r *http.Request) {
mystruct := { ... }
routes.ServeXml(w, &mystruct)
}
Helper function to serve Xml OR Json, depending on the value of the Accept
header:
func handler(w http.ResponseWriter, r *http.Request) {
mystruct := { ... }
routes.ServeFormatted(w, r, &mystruct)
}
You can restrict access to routes by assigning an AuthHandler
to a route.
Here is an example using a custom AuthHandler
per route. Image we are doing some type of Basic authentication:
func authHandler(w http.ResponseWriter, r *http.Request) bool {
user := r.URL.User.Username()
password := r.URL.User.Password()
if user != "xxx" && password != "xxx" {
// if we wanted, we could do an http.Redirect here
return false
}
return true
}
mux.Get("/:param", handler).SecureFunc(authHandler)
If you plan to use the same AuthHandler
to secure all of your routes, you may want to set the DefaultAuthHandler
:
routes.DefaulAuthHandler = authHandler
mux.Get("/:param", handler).Secure()
mux.Get("/:param", handler).Secure()
In the above examples, we implemented our own custom AuthHandler
. Check out the auth.go API which provides custom AuthHandlers for OAuth2 providers such as Google and Github.
Logging is enabled by default, but can be disabled:
mux.Logging = false
You can also specify your logger:
mux.Logger = log.New(os.Stdout, "", 0)