| Index: go/src/infra/tricium/service/default/handlers.go
|
| diff --git a/go/src/infra/tricium/service/default/handlers.go b/go/src/infra/tricium/service/default/handlers.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9488c98176f13c2a1816e97eb86197923fa6b0b4
|
| --- /dev/null
|
| +++ b/go/src/infra/tricium/service/default/handlers.go
|
| @@ -0,0 +1,37 @@
|
| +package handlers
|
| +
|
| +import (
|
| + "html/template"
|
| + "net/http"
|
| +
|
| + "appengine"
|
| + "appengine/taskqueue"
|
| +)
|
| +
|
| +func init() {
|
| + http.HandleFunc("/", landingPageHandler)
|
| + http.HandleFunc("/analyze", analyzeHandler)
|
| +}
|
| +
|
| +var basePage = template.Must(template.ParseFiles("templates/base.html"))
|
| +
|
| +func landingPageHandler(w http.ResponseWriter, r *http.Request) {
|
| + data := map[string]interface{}{
|
| + "Msg": "This service is under construction ...",
|
| + "ShowRequestForm": true,
|
| + }
|
| + basePage.Execute(w, data)
|
| +}
|
| +
|
| +func analyzeHandler(w http.ResponseWriter, r *http.Request) {
|
| + ctx := appengine.NewContext(r)
|
| + t := taskqueue.NewPOSTTask("/workflow-launcher/queue-handler", map[string][]string{"name": {"Analyze Request"}})
|
| + if _, err := taskqueue.Add(ctx, t, "workflow-launcher-queue"); err != nil {
|
| + http.Error(w, err.Error(), http.StatusInternalServerError)
|
| + return
|
| + }
|
| + data := map[string]interface{}{
|
| + "Msg": "Dummy analysis request sent.",
|
| + }
|
| + basePage.Execute(w, data)
|
| +}
|
|
|