Esempio n. 1
0
func main() {
	r := mux.NewRouter()
	app.RegisterRoutes(r)

	http.Handle("/", r)
	http.ListenAndServe(":9000", nil)
}
Esempio n. 2
0
package controllers_test

import (
	"github.com/drewolson/testflight"
	"github.com/gorilla/mux"
	"github.com/grsmv/gorilla-example/app"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var r = mux.NewRouter()

var _ = Describe("SampleController", func() {

	BeforeSuite(func() {
		app.RegisterRoutes(r)
	})

	Context("GET /", func() {
		It("should be OK", func() {
			testflight.WithServer(r, func(r *testflight.Requester) {
				response := r.Get("/")
				Expect(response.StatusCode).To(Equal(200))
			})
		})
	})

	Context("GET /books", func() {
		It("Should be OK too", func() {
			testflight.WithServer(r, func(r *testflight.Requester) {
				response := r.Get("/books")