Skip to content

Commit 77893a7

Browse files
committed
Added status route.
1 parent e66479b commit 77893a7

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.DS_Store
22
app/bin
3+
app/config.yml

app/DEVELOPER_NOTE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
To run this service during development, copy the "config.yml" file from assets/build/config.yml
2+
to the root app directory.

app/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ func checkWhitelist(request *http.Request, whitelist []string) bool {
6161
return inWhitelist
6262
}
6363

64+
func statusHandler(w http.ResponseWriter, r *http.Request) {
65+
w.WriteHeader(http.StatusOK)
66+
_, err := w.Write([]byte("The OCR processor service is running."))
67+
if err != nil {
68+
log.Fatal(err)
69+
}
70+
return
71+
}
72+
6473
func indexingHandler(config *Configuration, logger *log.Logger) http.HandlerFunc {
6574
return func(response http.ResponseWriter, request *http.Request) {
6675
// verify that the remote host is in whitelist
@@ -154,6 +163,7 @@ func main() {
154163

155164
// define routes
156165
mux.Handle("/item/", indexer)
166+
mux.HandleFunc("/status/", statusHandler)
157167

158168
// listen
159169
serverError := http.ListenAndServe(":"+config.HttpPort, mux)

0 commit comments

Comments
 (0)