-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
31 lines (27 loc) · 940 Bytes
/
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
package main
import (
"awesomeProject1/application/controllers"
"github.com/gorilla/mux"
"github.com/rs/cors"
"net/http"
)
func main() {
routerParent := mux.NewRouter().StrictSlash(true)
corsMiddleware := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
AllowedMethods: []string{
http.MethodPost,
http.MethodGet,
},
AllowedHeaders: []string{"*"},
AllowCredentials: false,
})
routerParent.HandleFunc("/ping", controllers.Ping).Methods("GET")
routerParent.HandleFunc("/login", controllers.Login).Methods("POST")
routerParent.HandleFunc("/uploadFile", controllers.UploadFile).Methods("POST")
routerParent.HandleFunc("/createUser", controllers.CreateUser).Methods("POST")
//routerParent.HandleFunc("/user", controllers.Login).Methods("GET")
//routerParent.HandleFunc("/refresh", controllers.Login).Methods("POST")
handler := corsMiddleware.Handler(routerParent)
http.ListenAndServe(":8080", handler)
}