add health method
This commit is contained in:
9
main.go
9
main.go
@@ -15,6 +15,14 @@ type FileSuccess struct {
|
|||||||
FileName string `json:"file_name"`
|
FileName string `json:"file_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func health(c echo.Context) error {
|
||||||
|
type Resp struct {
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.JSON(http.StatusOK, Resp{Status: "OK"})
|
||||||
|
}
|
||||||
|
|
||||||
func upload(c echo.Context) error {
|
func upload(c echo.Context) error {
|
||||||
file, err := c.FormFile("file")
|
file, err := c.FormFile("file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -53,6 +61,7 @@ func main() {
|
|||||||
|
|
||||||
e.Static("/", config.Env.Server.SharePath)
|
e.Static("/", config.Env.Server.SharePath)
|
||||||
e.POST("/upload", upload)
|
e.POST("/upload", upload)
|
||||||
|
e.GET("/health", health)
|
||||||
|
|
||||||
e.Logger.Fatal(e.Start(":" + config.Env.Server.Port))
|
e.Logger.Fatal(e.Start(":" + config.Env.Server.Port))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user