-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathmain.go
More file actions
71 lines (64 loc) · 1.71 KB
/
main.go
File metadata and controls
71 lines (64 loc) · 1.71 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package main
import (
"log"
"net/http"
"os"
"github.com/go-echarts/examples/examples"
)
func logRequest(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, r.URL)
handler.ServeHTTP(w, r)
})
}
func main() {
examplers := []examples.Exampler{
examples.BarExamples{},
examples.Bar3dExamples{},
examples.BoxplotExamples{},
examples.EffectscatterExamples{},
examples.FunnelExamples{},
examples.FunnelExamples{},
examples.GaugeExamples{},
examples.GeoExamples{},
examples.GraphExamples{},
examples.HeatmapExamples{},
examples.KlineExamples{},
examples.LineExamples{},
examples.Line3dExamples{},
examples.LiquidExamples{},
examples.MapExamples{},
examples.PageCenterLayoutExamples{},
examples.PageFlexLayoutExamples{},
examples.PageNoneLayoutExamples{},
examples.ParallelExamples{},
examples.PieExamples{},
examples.RadarExamples{},
//examples.CustomizeExamples{},
examples.SankeyExamples{},
examples.ScatterExamples{},
examples.Scatter3dExamples{},
examples.SunburstExample{},
examples.Surface3dExamples{},
examples.TreeExamples{},
examples.TreeMapExamples{},
examples.ThemeriverExamples{},
examples.ThemeExamples{},
examples.WordcloudExamples{},
examples.SunburstExample{},
}
for _, e := range examplers {
e.Examples()
}
serverPages := "true"
if len(os.Args) > 1 {
serverPages = os.Args[1]
}
if serverPages == "false" {
log.Println("Generated pages only, not server")
return
}
fs := http.FileServer(http.Dir("examples/html"))
log.Println("running server at http://localhost:8089")
log.Fatal(http.ListenAndServe("localhost:8089", logRequest(fs)))
}