-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (31 loc) · 1.05 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"AICS_WebBackend/controller"
"fmt"
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
log "github.com/sirupsen/logrus"
)
func main() {
log.SetLevel(log.DebugLevel)
fmt.Println("Hello world")
e := echo.New()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins:[]string{"*"},
AllowMethods:[]string{http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete},
}))
e.GET("/api/aicsweb/v1/test", controller.HelloWorld)
// user
e.POST("/api/aicsweb/v1/user/login", controller.LoginUser)
e.POST("/api/aicsweb/v1/user/register", controller.UserRegister)
e.PUT("/api/aicsweb/v1/user/info/:username", controller.UserChangePass)
// File and folder
e.GET("/api/aicsweb/v1/files/list", controller.SysFileGetList)
e.POST("/api/aicsweb/v1/files/download", controller.SysFileDownload)
e.POST("/api/aicsweb/v1/files/upload", controller.SysFileUpload)
//e.Logger.Fatal(e.Start("0.0.0.0:9001"))
e.Logger.Fatal(e.Start("0.0.0.0:9000"))
}