Skip to content

Instantly share code, notes, and snippets.

View codegangsta's full-sized avatar

Jeremy Saenz codegangsta

View GitHub Profile
// folder structure
// - templates/
// - admin/
// - index.tmpl
// - rendering.go
package main
import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/render"
package auth
import (
"encoding/base64"
"net/http"
)
func Basic(username string, password string) http.HandlerFunc {
var siteAuth = base64.StdEncoding.EncodeToString([]byte(username + ":" + password))
return func(res http.ResponseWriter, req *http.Request) {
package main
import (
"github.com/codegangsta/martini"
)
func main() {
m := martini.Classic()
m.Get("/", func() string {
return "hello world"