Skip to content

Commit

Permalink
added ASYNC env variable to make it easy for async demo
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilien committed Nov 21, 2019
1 parent 44eb0f2 commit 748afc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion funcs/summary/async_layout.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<head>
<h1>{{.PageTitle}}</h1>
<h1 style="color:powderblue;">{{.PageTitle}}</h1>
<meta charset="utf-8">

<link rel="stylesheet" href="http://mistic100.github.io/jQCloud/dist/jqcloud2/dist/jqcloud.min.css">
Expand Down
7 changes: 5 additions & 2 deletions funcs/summary/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ func Execute() error {

func (summaryFn *SummaryFn) summary(cmd *cobra.Command, args []string) error {
if summaryFn.StartServer {
http.HandleFunc("/", summaryFn.SummaryHandler)
http.HandleFunc("/async", summaryFn.SummaryAsyncHandler)
if os.Getenv("ASYNC") != "" {
http.HandleFunc("/", summaryFn.SummaryAsyncHandler)
} else {
http.HandleFunc("/", summaryFn.SummaryHandler)
}

return http.ListenAndServe(fmt.Sprintf(":%d", summaryFn.Port), nil)
} else {
Expand Down

0 comments on commit 748afc8

Please sign in to comment.