-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (29 loc) · 808 Bytes
/
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
package main
import (
"log"
"net/http"
"time"
"github.com/gorilla/mux"
)
func main() {
sb := &CurrencyService{}
go sb.Start(30)
amw := authenticationMiddleware{}
amw.Populate()
r := mux.NewRouter()
css := r.PathPrefix("/css").Subrouter()
script := r.PathPrefix("/scripts").Subrouter()
css.Handle("/", ServeStatic("./html/css"))
script.Handle("/", ServeStatic("./html/scripts"))
r.Path("/").Handler(HandleRequest(HomePageHandler))
//r.Handle("/login", HandleRequest(LoginPageHandler))
//r.Handle("/dashboard", amw.Middleware(HandleRequest(DashboardPageHandler)))
srv := &http.Server{
Handler: r,
Addr: ":8000",
// Good practice: enforce timeouts for servers you create!
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
log.Fatal(srv.ListenAndServe())
}