forked from amod-gupta/goauth-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
45 lines (36 loc) · 1.65 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
36
37
38
39
40
41
42
43
44
45
package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
/*
"github.com/Traceableai/goagent"
"github.com/Traceableai/goagent/config"
"github.com/Traceableai/goagent/instrumentation/net/traceablehttp"
*/)
func main() {
/*
cfg := config.Load()
shutdown := goagent.Init(cfg)
defer shutdown()
*/
router := mux.NewRouter()
/*
router.Handle("/login", traceablehttp.NewHandler(http.HandlerFunc(Login), "/login"))
router.Handle("/refresh", traceablehttp.NewHandler(http.HandlerFunc(Refresh), "/refresh"))
router.Handle("/test/{id}", traceablehttp.NewHandler(isAuthorized(test), "/test/{id}")).Methods("GET")
router.Handle("/customer/all", traceablehttp.NewHandler(isAuthorized(customercount), "/customer/all")).Methods("GET")
router.Handle("/customer/byid/{id}", traceablehttp.NewHandler(isAuthorized(customerbyid), "/customer/byid/{id}")).Methods("GET")
router.Handle("/crypto/home", traceablehttp.NewHandler(isAuthorized(cryptohome), "/crypto/home")).Methods("GET")
router.Handle("/crypto/price", traceablehttp.NewHandler(isAuthorized(cryptoprice), "/crypto/price")).Methods("GET")
*/
router.HandleFunc("/login", Login).Methods("GET")
router.HandleFunc("/refresh", Refresh).Methods("GET")
router.Handle("/test/{id}", isAuthorized(test)).Methods("GET")
router.Handle("/customer/all", isAuthorized(customercount)).Methods("GET")
router.Handle("/customer/byid/{id}", isAuthorized(customerbyid)).Methods("GET")
router.Handle("/crypto/home", isAuthorized(cryptohome)).Methods("GET")
router.Handle("/crypto/price", isAuthorized(cryptoprice)).Methods("GET")
//Start the server on port 8000
log.Fatal(http.ListenAndServe(":8000", router))
}