-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.go
35 lines (27 loc) · 1.04 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 (
"log"
"net/http"
"github.com/IntuitDeveloper/OAuth2-Go/config"
"github.com/IntuitDeveloper/OAuth2-Go/handlers"
)
func main() {
//call discovery
handlers.CallDiscoveryAPI()
//register static routes
fs := http.FileServer(http.Dir("static/"))
http.Handle("/", fs)
http.Handle("/static/", http.StripPrefix("/static/", fs))
http.Handle("/connected/", http.StripPrefix("/connected/", http.FileServer(http.Dir("static/connected/"))))
//register handler routes
http.HandleFunc("/getCompanyInfo", handlers.GetCompanyInfo)
http.HandleFunc("/refreshToken", handlers.RefreshToken)
http.HandleFunc("/revokeToken", handlers.RevokeToken)
http.HandleFunc("/connectToQuickbooks", handlers.ConnectToQuickbooks)
http.HandleFunc("/signInWithIntuit", handlers.SignInWithIntuit)
http.HandleFunc("/getAppNow", handlers.GetAppNow)
http.HandleFunc("/oauth2redirect", handlers.CallBackFromOAuth)
//log and start server
log.Println("running server on ", config.OAuthConfig.Port)
log.Fatal(http.ListenAndServe(config.OAuthConfig.Port, nil))
}