-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
39 lines (31 loc) · 966 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
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"net/http"
"github.com/hello-slide/account-manager/handler"
"github.com/hello-slide/account-manager/oauth"
networkutil "github.com/hello-slide/network-util"
)
func init() {
// initialize dapr client.
if err := handler.InitClient(); err != nil {
panic(err)
}
// Set google oauth config.
oauth.SetConfig()
}
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", handler.RootHandler)
mux.HandleFunc("/account/login", handler.LoginHandler)
mux.HandleFunc("/account/login/redirect", handler.LoginRedirectHandler)
mux.HandleFunc("/account/update", handler.UpdateHandler)
mux.HandleFunc("/account/user", handler.UserHandler)
mux.HandleFunc("/account/logout", handler.LogoutHandler)
mux.HandleFunc("/account/delete", handler.DeleteHandler)
networkHandler := networkutil.CorsConfig.Handler(mux)
if err := http.ListenAndServe(":3000", networkHandler); err != nil {
fmt.Println(err)
}
handler.CloseClient()
}