-
Notifications
You must be signed in to change notification settings - Fork 1
/
mux.go
34 lines (26 loc) · 700 Bytes
/
mux.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
package main
import (
"log"
"net/http"
"github.com/koltyakov/az-fun-go-sp/handlers"
)
// Routes configuration
func initRoutes() {
// Creating SharePoint API client instance
sp := getSP()
// Creating Azure Storage Account API instance
sa, err := getSA()
if err != nil {
log.Fatalf("can't create storage account client, %s\n", err)
}
// Constructing handlers struct
h := handlers.NewHandlers(sp, sa)
// Binding Functions with Handlers
http.HandleFunc("/api/lists", h.Lists)
http.HandleFunc("/api/fields", h.Fields)
http.HandleFunc("/api/storage", h.Storage)
// Wildcard route /api/*
http.HandleFunc("/api/", h.Wildcard)
// Timer job(s)
http.HandleFunc("/timer", h.Timer)
}