Organize route handlers

This commit is contained in:
2024-09-24 09:57:51 +07:00
parent 757dde58c0
commit db566fd9a4
16 changed files with 226 additions and 341 deletions

View File

@ -1,28 +0,0 @@
package errorHandler
import (
"fmt"
"github.com/fossyy/filekeeper/app"
"github.com/fossyy/filekeeper/view/client/error"
"net/http"
)
func NotFound(w http.ResponseWriter, r *http.Request) {
component := errorView.NotFound("Not Found")
err := component.Render(r.Context(), w)
if err != nil {
fmt.Fprint(w, err.Error())
app.Server.Logger.Error(err.Error())
return
}
}
func InternalServerError(w http.ResponseWriter, r *http.Request) {
component := errorView.InternalServerError("Internal Server Error")
err := component.Render(r.Context(), w)
if err != nil {
fmt.Fprint(w, err.Error())
app.Server.Logger.Error(err.Error())
return
}
}