Beispiel #1
0
// Setup all routes for Web-Frontend
func setupWebFrontend(router *httprouter.Router) {
	// Index
	router.GET("/", routes.ViewIndex)
	router.GET("/status/:url", routes.ViewIndex)
	router.GET("/results/:url", routes.ViewIndex)

	// Admin
	router.GET("/admin", routes.ViewAdmin)
	router.GET("/admin/login", routes.ViewLogin)

	// Static Files
	router.ServeFiles("/public/*filepath", http.Dir("public"))
}
Beispiel #2
0
// Add routes to http router
// TODO: Add route description parameters and useage
func AddRoutes(router *httprouter.Router) {
	router.ServeFiles("/static/*filepath", http.Dir("./static"))

	router.GET("/", CheckAuth(Index))
	router.GET("/actions", CheckAuth(Actions))
	router.GET("/actions/:ActionId", CheckAuth(ActionById))
	//router.POST("/set/:SetId", PostAction)
	router.GET("/actions/:ActionId/occurrences", Occurrences)
	router.GET("/occurrences/:OccurrenceId", OccurrenceById)

	router.POST("/users", PostUser)
	router.GET("/auth/login", LoginPage)
	router.POST("/auth/login", AuthLogin)

	router.POST("/actions/:ActionId", CheckAuth(PostOccurrence))
	router.POST("/actions/", CheckAuth(PostAction))

	// TODO:
	// router.GET("/sets", sets)
	// router.GET("/sets/:SetId/actions", actionsFromSet)
}
Beispiel #3
0
func setupStaticRoutes(router *httprouter.Router) {
	router.ServeFiles("/assets/*filepath", http.Dir("assets"))
}