FEAT: Initial Upload Page

This commit is contained in:
fahd
2026-08-12 19:03:02 +03:00
parent 7754051e9c
commit dc2d1c6e33
14 changed files with 1005 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
package main
import (
"context"
"fmt"
"log"
"net/http"
"thamanyah/cms/v2/internal/handlers"
"thamanyah/cms/v2/internal/services"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
func main() {
config, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
panic(fmt.Errorf("failed To Load S3 Config: %s", err))
}
services.S3Client = &services.S3Concrete{
S3Client: s3.NewFromConfig(config),
Bucket: "",
}
mux := http.NewServeMux()
mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
mux.HandleFunc("GET /", handlers.Home)
mux.HandleFunc("GET /api/hello", handlers.Hello)
mux.HandleFunc("GET /health", handlers.Health)
mux.HandleFunc("GET /videos/new", handlers.NewVideo)
mux.HandleFunc("POST /videos/presign", handlers.PresignVideoUpload)
mux.HandleFunc("POST /videos", handlers.CompleteVideoUpload)
addr := ":8081"
log.Printf("listening on %s", addr)
if err := http.ListenAndServe(addr, mux); err != nil {
log.Fatal(err)
}
}