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

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

Issue 2125603002: Adds initial Tricium service GAE configs (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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 "fmt"
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 landingPage = `
Paweł Hajdan Jr. 2016/07/05 12:16:00 Please consider using https://golang.org/pkg/html/
emso 2016/07/06 06:21:28 Done. Thanks, much better.
17 <html>
18 <head><title>Tricium</title></head>
19 <body>
20 <font face="sans-serif">
21 == T R I C I U M ==
22 <hr size="1">
23 <p>This service is under construction ...</p>
24 <hr size="1">
25 <form action="/analyze" method="post">
26 <div><input type="submit" value="Dummy Analysis Request"></div>
27 </form>
28 </body>
29 </html>`
30
31 var analysisRequestedPage = `
32 <html>
33 <head><title>Tricium</title></head>
34 <body>
35 <font face="sans-serif">
36 == T R I C I U M ==
37 <hr size="1">
38 Analysis request enqueued.
39 <hr size="1">
40 Back to the <a href="/">landing page</a>.
41 </form>
42 </font>
43 </body>
44 </html>
45 `
46
47 func landingPageHandler(w http.ResponseWriter, r *http.Request) {
48 fmt.Fprint(w, landingPage)
49 }
50
51 func analyzeHandler(w http.ResponseWriter, r *http.Request) {
52 ctx := appengine.NewContext(r)
53 t := taskqueue.NewPOSTTask("/workflow-launcher/queue-handler", map[strin g][]string{"name": {"Analyze Request"}})
Paweł Hajdan Jr. 2016/07/05 12:16:00 Please consider using https://cloud.google.com/app
emso 2016/07/06 06:21:28 I have considered this alternative and don't think
54 if _, err := taskqueue.Add(ctx, t, "workflow-launcher-queue"); err != ni l {
55 http.Error(w, err.Error(), http.StatusInternalServerError)
56 return
57 }
58 fmt.Fprint(w, analysisRequestedPage)
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698