Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: go/src/infra/tricium/service/default/handlers.go

Issue 2125603002: Adds initial Tricium service GAE configs (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Adds optional display of the request form Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 package handlers
2
3 import (
4 "html/template"
5 "net/http"
6
7 "appengine"
8 "appengine/taskqueue"
9 )
10
11 func init() {
12 http.HandleFunc("/", landingPageHandler)
13 http.HandleFunc("/analyze", analyzeHandler)
14 }
15
16 var basePage = template.Must(template.ParseFiles("templates/base.html"))
17
18 func landingPageHandler(w http.ResponseWriter, r *http.Request) {
19 data := map[string]interface{}{
20 "Msg": "This service is under construction ...",
21 "ShowRequestForm": true,
22 }
23 basePage.Execute(w, data)
24 }
25
26 func analyzeHandler(w http.ResponseWriter, r *http.Request) {
27 ctx := appengine.NewContext(r)
28 t := taskqueue.NewPOSTTask("/workflow-launcher/queue-handler", map[strin g][]string{"name": {"Analyze Request"}})
29 if _, err := taskqueue.Add(ctx, t, "workflow-launcher-queue"); err != ni l {
30 http.Error(w, err.Error(), http.StatusInternalServerError)
31 return
32 }
33 data := map[string]interface{}{
34 "Msg": "Dummy analysis request sent.",
35 }
36 basePage.Execute(w, data)
37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698