Beispiel #1
0
// 注册路由
func (self ResourceController) RegisterRoute(g *echo.Group) {
	g.GET("/resources", self.ReadList)
	g.GET("/resources/cat/:catid", self.ReadCatResources)
	g.GET("/resources/:id", self.Detail)
	g.Match([]string{"GET", "POST"}, "/resources/new", self.Create, middleware.NeedLogin(), middleware.Sensivite(), middleware.PublishNotice())
	g.Match([]string{"GET", "POST"}, "/resources/modify", self.Modify, middleware.NeedLogin(), middleware.Sensivite())
}
Beispiel #2
0
// 注册路由
func (self ProjectController) RegisterRoute(g *echo.Group) {
	g.GET("/projects", self.ReadList)
	g.Match([]string{"GET", "POST"}, "/project/new", self.Create, middleware.NeedLogin(), middleware.Sensivite(), middleware.PublishNotice())
	g.Match([]string{"GET", "POST"}, "/project/modify", self.Modify, middleware.NeedLogin(), middleware.Sensivite())
	g.GET("/p/:uri", self.Detail)
	g.GET("/project/uri", self.CheckExist)
}
Beispiel #3
0
// 注册路由
func (self RuleController) RegisterRoute(g *echo.Group) {
	g.GET("/crawl/rule/list", self.RuleList)
	g.POST("/crawl/rule/query.html", self.Query)
	g.Match([]string{"GET", "POST"}, "/crawl/rule/new", self.New)
	g.Match([]string{"GET", "POST"}, "/crawl/rule/modify", self.Modify)
	g.POST("/crawl/rule/del", self.Del)
}
Beispiel #4
0
// Configure setups all resource functions in order to work with database operations
func Configure(g *echo.Group) {
	g.Use(auth.AnyAuth())
	g.Post("/", msg.JSONResource(Create))
	g.Get("/:id", msg.JSONResource(Retrieve))
	g.Patch("/:id", msg.JSONResource(Update))
	g.Delete("/:id", msg.JSONResource(Delete))
}
Beispiel #5
0
// 注册路由
func (self MessageController) RegisterRoute(g *echo.Group) {
	messageG := g.Group("/message/", middleware.NeedLogin())

	messageG.GET(":msgtype", self.ReadList)
	messageG.GET("system", self.ReadList)
	messageG.Match([]string{"GET", "POST"}, "send", self.Send)
	messageG.POST("delete", self.Delete)

	// g.GET("/message/:msgtype", self.ReadList, middleware.NeedLogin())
	// g.GET("/message/system", self.ReadList, middleware.NeedLogin())
	// g.Match([]string{"GET", "POST"}, "/message/send", self.Send, middleware.NeedLogin())
	// g.POST("/message/delete", self.Delete, middleware.NeedLogin())
}
Beispiel #6
0
// 注册路由
func (self ProjectController) RegisterRoute(g *echo.Group) {
	g.GET("/crawl/project/list", self.ProjectList)
	g.POST("/crawl/project/query.html", self.ProjectQuery)
	g.Match([]string{"GET", "POST"}, "/crawl/project/new", self.CrawlProject)
	g.Match([]string{"GET", "POST"}, "/crawl/project/modify", self.Modify)
}
Beispiel #7
0
// 注册路由
func (this *ArticleController) RegisterRoute(g *echo.Group) {
	g.Get("/articles", this.ReadList)
	g.Get("/articles/:id", this.Detail)
}
Beispiel #8
0
// User related endpoints
func registerUserHandlers(router *echo.Group, userService handler.UserService) {
	router.Get("/users/:id", userService.Show)
	router.Get("/users", userService.List)
	router.Post("/users", userService.Create)
}
Beispiel #9
0
func (self ImageController) RegisterRoute(g *echo.Group) {
	g.POST("/image/upload", self.Upload)
	g.Match([]string{"GET", "POST"}, "/image/transfer", self.Transfer)
}
Beispiel #10
0
// 注册路由
func (self InstallController) RegisterRoute(g *echo.Group) {
	g.GET("/install", self.SetupConfig)
	g.Match([]string{"GET", "POST"}, "/install/setup-config", self.SetupConfig)
	g.Match([]string{"GET", "POST"}, "/install/do", self.DoInstall)
	g.Match([]string{"GET", "POST"}, "/install/options", self.SetupOptions)
}
Beispiel #11
0
// 注册路由
func (self ReadingController) RegisterRoute(g *echo.Group) {
	g.GET("/reading/list", self.ReadingList)
	g.POST("/reading/query.html", self.ReadingQuery)
	g.Match([]string{"GET", "POST"}, "/reading/publish", self.Publish)
}
Beispiel #12
0
// 注册路由
func (self SearchController) RegisterRoute(g *echo.Group) {
	g.GET("/search", self.Search)
}
Beispiel #13
0
// 注册路由
func (self ReadingController) RegisterRoute(g *echo.Group) {
	g.GET("/readings", self.ReadingList)
	g.GET("/readings/:id", self.IReading)
}
Beispiel #14
0
// APIRoutes definition
// ========== API ROUTES ======
func APIRoutes(api *echo.Group) {

	// ======= ADMIN API ======
	admin := controllers.AdminController{}
	api.Get("/time", admin.GetTime)

	posts := controllers.PostsController{}
	api.GET("/posts/:id", posts.GetOne)
	api.GET("/posts", posts.Get)
	api.POST("/posts", posts.Save)
	api.PUT("/posts/:id", posts.Update)

	// CRUD /api/tags
	tags := controllers.TagsController{}
	api.GET("/tags/:id", tags.GetOne)
	api.GET("/tags", tags.Get)
	api.POST("/tags", tags.Save)
	api.PUT("/tags/:id", tags.Update)
	/*	api.Delete("/tags/:id", tags.Destroy)
	 */
}
Beispiel #15
0
// 注册路由
func (self LikeController) RegisterRoute(g *echo.Group) {
	g.POST("/like/:objid", self.Like, middleware.NeedLogin())
}
Beispiel #16
0
// Configure setups all resource functions in order to work with database operations
func Configure(g *echo.Group) {
	g.Use(auth.AnyAuth())
	g.Post("/", msg.JSONResource(ExchageDigits))
	g.Delete("/:id", msg.JSONResource(CloseSession))
}
Beispiel #17
0
// 注册路由
func (self TopicController) RegisterRoute(g *echo.Group) {
	g.GET("/topics", self.Topics)
	g.GET("/topics/no_reply", self.TopicsNoReply)
	g.GET("/topics/last", self.TopicsLast)
	g.GET("/topics/:tid", self.Detail)
	g.GET("/topics/node/:nid", self.NodeTopics)

	g.Match([]string{"GET", "POST"}, "/topics/new", self.Create, middleware.NeedLogin(), middleware.Sensivite(), middleware.PublishNotice())
	g.Match([]string{"GET", "POST"}, "/topics/modify", self.Modify, middleware.NeedLogin(), middleware.Sensivite())
}
Beispiel #18
0
// 注册路由
func (self UserController) RegisterRoute(g *echo.Group) {
	g.GET("/user/:username", self.Home)
	g.GET("/users", self.ReadList)
	g.Match([]string{"GET", "POST"}, "/user/email/unsubscribe", self.EmailUnsub)
}
Beispiel #19
0
func (this *WebsocketController) RegisterRoute(g *echo.Group) {
	g.GET("/ws", standard.WrapHandler(websocket.Handler(this.Ws)))
}
Beispiel #20
0
// Bind attaches api routes
func (api *API) Bind(group *echo.Group) {
	group.Get("/v1/conf", api.ConfHandler)
}
Beispiel #21
0
func (self CommentController) RegisterRoute(g *echo.Group) {
	g.Get("/at/users", self.AtUsers)
	g.Post("/comment/:objid", self.Create, middleware.NeedLogin(), middleware.Sensivite(), middleware.PublishNotice())
	g.Get("/object/comments", self.CommentList)
}
Beispiel #22
0
// 注册路由
func (self WikiController) RegisterRoute(g *echo.Group) {
	g.Match([]string{"GET", "POST"}, "/wiki/new", self.Create, middleware.NeedLogin(), middleware.Sensivite())
	g.GET("/wiki", self.ReadList)
	g.GET("/wiki/:uri", self.Detail)
}
Beispiel #23
0
// 注册路由
func (self ArticleController) RegisterRoute(g *echo.Group) {
	g.GET("/crawl/article/list", self.ArticleList)
	g.POST("/crawl/article/query.html", self.ArticleQuery)
	g.Match([]string{"GET", "POST"}, "/crawl/article/new", self.CrawlArticle)
	g.Match([]string{"GET", "POST"}, "/crawl/article/modify", self.Modify)
}
Beispiel #24
0
// 注册路由
func (self IndexController) RegisterRoute(g *echo.Group) {
	g.GET("/", self.Index)
	g.GET("/wr", self.WrapUrl)
	g.GET("/pkgdoc", self.Pkgdoc)
}
Beispiel #25
0
// Configure will set all routes needed by this module
func Configure(g *echo.Group) {
	g.Use(auth.AnyAuth())
	g.Get("/", msg.JSONResource(List))
	g.Get("/:gid", msg.JSONResource(Create))
	g.Post("/:gid", msg.JSONResource(Retrieve))
	g.Patch("/:gid", msg.JSONResource(Update))
	g.Delete("/:gid", msg.JSONResource(Delete))

	g.Post("/:gid/members/:mid", msg.JSONResource(AddMember))
	g.Post("/:gid/members/:mid/admin", msg.JSONResource(AddAdmin))
	g.Delete("/:gid/members/:mid/admin", msg.JSONResource(DelAdmin))
	g.Delete("/:gid/members/:mid", msg.JSONResource(DelMember))
}
Beispiel #26
0
// 注册路由
func (self AccountController) RegisterRoute(g *echo.Group) {
	g.Any("/account/register", self.Register)
	g.Post("/account/send_activate_email", self.SendActivateEmail)
	g.Get("/account/activate", self.Activate)
	g.Any("/account/login", self.Login)
	g.Any("/account/edit", self.Edit, middleware.NeedLogin())
	g.Post("/account/change_avatar", self.ChangeAvatar, middleware.NeedLogin())
	g.Post("/account/changepwd", self.ChangePwd, middleware.NeedLogin())
	g.Any("/account/forgetpwd", self.ForgetPasswd)
	g.Any("/account/resetpwd", self.ResetPasswd)
	g.Get("/account/logout", self.Logout, middleware.NeedLogin())
}
Beispiel #27
0
func (self SidebarController) RegisterRoute(g *echo.Group) {
	g.GET("/readings/recent", self.RecentReading)
	g.GET("/topics/:nid/others", self.OtherTopics)
	g.GET("/websites/stat", self.WebsiteStat)
	g.GET("/dynamics/recent", self.RecentDynamic)
	g.GET("/topics/recent", self.RecentTopic)
	g.GET("/articles/recent", self.RecentArticle)
	g.GET("/projects/recent", self.RecentProject)
	g.GET("/resources/recent", self.RecentResource)
	g.GET("/comments/recent", self.RecentComment)
	g.GET("/nodes/hot", self.HotNodes)
	g.GET("/users/active", self.ActiveUser)
	g.GET("/users/newest", self.NewestUser)
}
Beispiel #28
0
// ConfigureHTTPGroup setups the websocket listener
func ConfigureHTTPGroup(g *echo.Group) {
	g.Use(auth.AnyAuth())
	g.WebSocket("", msg.JSONResource(AcceptClient))
}
Beispiel #29
0
// 注册路由
func (self FavoriteController) RegisterRoute(g *echo.Group) {
	g.Post("/favorite/:objid", self.Create, middleware.NeedLogin())
	g.Get("/favorites/:username", self.ReadList)
}
Beispiel #30
0
// 注册路由
func (self ToolController) RegisterRoute(g *echo.Group) {
	g.GET("/tool/sitemap", self.GenSitemap)
}