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

Unified 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 copyright comments and infra testing files 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/tricium/service/default/default.yaml ('k') | go/src/infra/tricium/service/default/templates » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8f5a67ef99971f60961e6ba26c51cf7d41f72889
--- /dev/null
+++ b/go/src/infra/tricium/service/default/handlers.go
@@ -0,0 +1,42 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Package handlers implements HTTP handlers for the default module.
+package handlers
+
+import (
+ "html/template"
+ "net/http"
+
+ "google.golang.org/appengine"
+ "google.golang.org/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)
nodir 2016/07/12 17:10:38 drive by: the returned error is silently ignored.
emso 2016/07/14 06:48:42 Yes, added a fix for this in https://codereview.ch
+}
+
+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)
+}
« no previous file with comments | « go/src/infra/tricium/service/default/default.yaml ('k') | go/src/infra/tricium/service/default/templates » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698