Exemplo n.º 1
0
// TestUsers is the entry point for the users tests.
func TestUsers(t *testing.T) {
	c := &app.Context{
		Session:   app.GetSession(),
		SessionID: "TESTING",
	}
	defer c.Session.Close()

	a := routes.API().(*app.App)

	//usersList404(t, a, c)
	usersCreate200(t, a, c)
	usersCreate400(t, a, c)
	us := usersList200(t, a, c)
	usersRetrieve200(t, a, c, us[0].UserID)
	usersRetrieve404(t, a, c, bson.NewObjectId().Hex())
	usersRetrieve400(t, a, c, "123")
	usersUpdate200(t, a, c)
	usersRetrieve200(t, a, c, us[0].UserID)
	usersDelete200(t, a, c, us[0].UserID)
	usersDelete404(t, a, c, us[0].UserID)
}
Exemplo n.º 2
0
// main is the entry point for the application.
func main() {
	log.Println("main : Started")

	// Check the environment for a configured port value.
	port := os.Getenv("PORT")
	if port == "" {
		port = "3000"
	}

	// Create this goroutine to run the web server.
	go func() {
		log.Println("listener : Started : Listening on: http://localhost:" + port)
		http.ListenAndServe(":"+port, routes.API())
	}()

	// Listen for an interrupt signal from the OS.
	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, os.Interrupt)
	<-sigChan

	log.Println("main : Completed")
}