// 注册路由 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) }
// 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) */ }
// 注册路由 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) }
// 注册路由 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) }
func (self ImageController) RegisterRoute(g *echo.Group) { g.POST("/image/upload", self.Upload) g.Match([]string{"GET", "POST"}, "/image/transfer", self.Transfer) }
// 注册路由 func (self LikeController) RegisterRoute(g *echo.Group) { g.POST("/like/:objid", self.Like, middleware.NeedLogin()) }
// 注册路由 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) }