-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (29 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 (
"fmt"
"net/http"
"os"
log "github.com/sirupsen/logrus"
"github.com/MSU-Bot/msubot-appspot/server"
"github.com/MSU-Bot/msubot-appspot/server/checksections"
"github.com/MSU-Bot/msubot-appspot/server/healthcheck"
"github.com/MSU-Bot/msubot-appspot/server/messenger"
"github.com/MSU-Bot/msubot-appspot/server/pruner"
"github.com/MSU-Bot/msubot-appspot/server/scraper"
)
func main() {
http.HandleFunc("/sections", scraper.HandleRequest)
http.HandleFunc("/welcomeuser", server.WelcomeUserHandler)
http.HandleFunc("/checktrackedsections", checksections.HandleRequest)
http.HandleFunc("/prunesections", pruner.HandleRequest)
http.HandleFunc("/receivemessage", messenger.RecieveMessage)
http.HandleFunc("/healthcheck", healthcheck.CheckHealth)
http.HandleFunc("/updatedepartments", scraper.HandleDepartmentRequest)
port := os.Getenv("PORT")
if port == "" {
port = "8082"
log.Printf("Defaulting to port %s", port)
}
log.Printf("Listening on port %s", port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
}