-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.go
43 lines (34 loc) · 1.1 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
package main
import (
"fmt"
"net/http"
"os"
"github.com/fjukstad/luft/controllers"
// "github.com/luft-1/controllers"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/niluaqis", controllers.NILUAqiHandler)
mux.HandleFunc("/historical", controllers.HistoricalHandler)
mux.HandleFunc("/forecast", controllers.ForecastHandler)
mux.HandleFunc("/studentaqis", controllers.StudentAqisHandler)
mux.HandleFunc("/student", controllers.StudentHandler)
mux.HandleFunc("/precipitation", controllers.PrecipitationHandler)
mux.HandleFunc("/sendfile", controllers.PostFileHandler)
mux.Handle("/public/", http.FileServer(http.Dir(".")))
mux.HandleFunc("/", controllers.IndexHandler)
mux.HandleFunc("/live", controllers.LiveHandler)
mux.HandleFunc("/history", controllers.HistoryHandler)
mux.HandleFunc("/upload", controllers.UploadHandler)
mux.HandleFunc("/resources", controllers.ResourcesHandler)
port := os.Getenv("PORT")
if port == "" {
port = "8000"
}
fmt.Println("Server started on port", port)
err := http.ListenAndServe(":"+port, mux)
if err != nil {
fmt.Println(err)
return
}
}