-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.go
31 lines (24 loc) · 836 Bytes
/
index.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
package main
import (
"log"
"net/http"
)
func main() {
fs := http.FileServer(http.Dir("public"))
http.Handle("/api/styles/", http.StripPrefix("/api/styles/", http.FileServer(http.Dir("public"))))
http.Handle("/api/sidebar", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "public/components/layout/sidebar.html")
}))
http.Handle("/api/header", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "public/components/layout/header.html")
}))
http.Handle("/api/dashboard", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "public/components/layout/dashboard.html")
}))
http.Handle("/", fs)
log.Println("Listening on :3000...")
err := http.ListenAndServe(":3000", nil)
if err != nil {
log.Fatal(err)
}
}