コード例 #1
0
ファイル: main.go プロジェクト: sjoshi6/peer2peer
// StartAuthServer is used to start the auth server
func StartAuthServer(port string) {

	// Creating a new mux router
	var authrouter = mux.NewRouter().StrictSlash(true)

	// Add Auth routes
	authrouter = routers.AddAuthRoutes(authrouter)

	n := negroni.Classic()

	n.UseHandler(authrouter)
	n.Run(port)
}
コード例 #2
0
ファイル: main.go プロジェクト: sjoshi6/peer2peer
// StartServer : Start the API Server by calling this function
func StartServer(port string) {

	// Need to activate this for token based access
	var a controllers.Auth

	// Creating a new mux router
	var router = mux.NewRouter().StrictSlash(true)

	// Add APP routes for various controllers
	router = routers.AddVisitorRoutes(router)

	// This route is essential to view the monitoring stats for the app.
	router.Handle("/debug/vars", http.DefaultServeMux)

	n := negroni.Classic()

	// Need to activate this for token based access
	n.Use(negroni.HandlerFunc(a.RequireTokenAuthentication))

	n.UseHandler(router)
	n.Run(port)

}