This commit is contained in:
teddy
2025-04-21 10:16:40 +07:00
parent 04de3f84a7
commit c4e963e8f5
2 changed files with 9 additions and 8 deletions

View File

@@ -9,8 +9,8 @@ services:
condition: on-failure
resources:
limits:
cpus: "0.5"
memory: "300m"
cpus: "0.1"
memory: "100m"
restart: always
ports:
- "7010:3000"

View File

@@ -193,15 +193,16 @@ func Route(db *gorm.DB) {
w.Write([]byte("success"))
}))
http.HandleFunc("*", middleware.ResponseTimeMiddleware(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(404)
w.Write([]byte("what are you looking for!?"))
}))
http.Handle("/", middleware.ResponseTimeMiddleware(func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
}
if r.URL.Path != "/" {
w.WriteHeader(404)
w.Write([]byte("What are you looking for?!"))
} else {
w.Write([]byte("Welcome!"))
}
}))
}