1
0

HTTP endpoints reorganised.

This commit is contained in:
Alexander Andreev 2023-05-06 23:12:37 +04:00
parent a736cc508f
commit 13053bbc21
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -61,23 +61,32 @@ func main() {
srv.GET("/stuff/article/*filepath", hand.Article)
srv.GET("/mindflow", hand.Mindflow)
srv.GET("/about", hand.About)
srv.GET("/guestbook", hand.Guestbook)
srv.POST("/guestbook", hand.GuestbookPost)
srv.GET("/guestbook/admin", hand.GuestbookAdmin)
srv.DELETE("/guestbook/admin/entry/:id", hand.GuestbookAdminDeleteEntry)
srv.POST("/guestbook/admin/entry/:id", hand.GuestbookAdminUpdateEntry)
srv.DELETE("/guestbook/admin/reply/:id", hand.GuestbookAdminDeleteReply)
srv.POST("/guestbook/admin/reply/:id", hand.GuestbookAdminUpdateReply)
srv.POST("/guestbook/admin/reply/", hand.GuestbookAdminReply)
srv.GET("/robots.txt", hand.Robots)
srv.GET("/rss.xml", hand.RSS)
srv.POST("/api/captcha/", hand.CaptchaNew)
srv.POST("/api/captcha/:id", hand.CaptchaSolve)
srv.GET("/api/captcha/:id/image", hand.CaptchaImage)
captchaApi := http.NewCaptchaApiHandlers(*captchaExpiry)
srv.POST("/api/captcha/", captchaApi.New)
srv.POST("/api/captcha/:id", captchaApi.Solve)
srv.GET("/api/captcha/:id/image", captchaApi.Image)
guestbookApi := http.NewGuestbookApiHandlers(*databasesPath, *guestbookOwner, *guestbookPageSize)
srv.POST("/api/guestbook", guestbookApi.New)
srv.PATCH("/api/guestbook/:id", guestbookApi.Edit)
srv.DELETE("/api/guestbook/:id", guestbookApi.Delete)
srv.POST("/api/guestbook/:id/reply", guestbookApi.Reply)
srv.PATCH("/api/guestbook/:id/reply", guestbookApi.Reply)
srv.DELETE("/api/guestbook/:id/reply", guestbookApi.DeleteReply)
mindflowApi := http.NewMindflowApiHandlers()
srv.POST("/api/mindflow", mindflowApi.New)
srv.POST("/api/mindflow/:id", mindflowApi.Edit)
srv.DELETE("/api/mindflow/:id", mindflowApi.Delete)
if err := srv.Start(network, *listenAddress); err != nil {
log.Fatalln(err)