FEAT: Added Swagger Docs
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m20s

This commit is contained in:
FahdShalhoub
2026-08-16 23:42:00 +03:00
parent cdc5315401
commit f26ea98b52
8 changed files with 1073 additions and 26 deletions
+12
View File
@@ -13,8 +13,16 @@ import (
"github.com/aws/aws-sdk-go-v2/service/mediaconvert"
"github.com/aws/aws-sdk-go-v2/service/s3"
_ "github.com/lib/pq"
httpSwagger "github.com/swaggo/http-swagger/v2"
_ "thamanyah/cms/v2/docs"
)
// @title Thamanyah CMS API
// @version 1.0
// @description JSON API for ingesting videos into the Thamanyah catalogue. Uploads are two-step: presign, PUT the file straight to S3, then register the video to queue transcoding.
// @BasePath /
func main() {
if len(os.Args) > 1 && os.Args[1] == "migrate" {
runMigrate()
@@ -83,6 +91,10 @@ func runServer() {
mux.HandleFunc("POST /api/videos/presign", handlers.PresignVideoUpload)
mux.HandleFunc("POST /api/videos", handlers.CompleteVideoUpload)
// Swagger UI and the generated spec. The UI assets are embedded in the
// binary by swaggo/files, so this needs no static directory on disk.
mux.Handle("GET /swagger/", httpSwagger.WrapHandler)
addr := ":8081"
log.Printf("listening on %s", addr)
if err := http.ListenAndServe(addr, mux); err != nil {