示例#1
0
func setupMiddleware(httpListener *listener.HTTPListenerService, appContext *middleware.AppContext) {
	httpListener.
		AddMiddleware(appContext.Logger).
		AddMiddleware(appContext.StartAppContext).
		AddMiddleware(appContext.AccessControl).
		AddMiddleware(appContext.OptionsHandler)
}
示例#2
0
/*
Add routes here using AddRoute and AddRouteWithMiddleware.
*/
func setupRoutes(httpListener *listener.HTTPListenerService, appContext *middleware.AppContext) {
	httpListener.
		AddStaticRoute("/assets/", "./www/assets").
		AddRoute("/", controllers.Index, "GET").
		AddRoute("/admin", controllers.Admin, "GET").
		AddRoute("/savedsearches", controllers.ManageSavedSearches, "GET").
		AddRoute("/servicesettings", controllers.GetServiceSettings, "GET", "OPTIONS").
		AddRoute("/version", controllers.GetVersion, "GET", "OPTIONS")
}