示例#1
0
func main() {
	app := new(bear.App)

	handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		views.Error(w, 404, "not_found", models.NewPageCtx(r))
	})

	app.Use(Logger)
	app.Use(NotFound(handler))
	app.Use(FileServer(http.Dir("./public")))
	app.Use(BodyParser)

	app.ListenAndServe(":8080", routes.Mux())
}
示例#2
0
	"github.com/nucleartide/simplebdd"
)

var (
	Describe   = simplebdd.Describe
	It         = simplebdd.It
	BeforeEach = simplebdd.BeforeEach
	AfterEach  = simplebdd.AfterEach
)

var (
	NotFound  = middleware.NotFound
	Custom404 = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "here be a 404")
	})
	TestHandler = alice.New(NotFound(Custom404)).Then(routes.Mux())
)

// Database configuration.
const (
	DBNAME   = "go_wires_test"
	USER     = "******"
	PASSWORD = "******"
	HOST     = "localhost"
	PORT     = "5432"
	SSLMODE  = "disable"
)

var DSN = fmt.Sprintf(
	"dbname=%s user=%s password=%s host=%s port=%s sslmode=%s",
	DBNAME, USER, PASSWORD, HOST, PORT, SSLMODE,