Skip to content

Commit

Permalink
Added status route.
Browse files Browse the repository at this point in the history
  • Loading branch information
mspalti committed May 2, 2022
1 parent e66479b commit 77893a7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
app/bin
app/config.yml
2 changes: 2 additions & 0 deletions app/DEVELOPER_NOTE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To run this service during development, copy the "config.yml" file from assets/build/config.yml
to the root app directory.
10 changes: 10 additions & 0 deletions app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ func checkWhitelist(request *http.Request, whitelist []string) bool {
return inWhitelist
}

func statusHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, err := w.Write([]byte("The OCR processor service is running."))
if err != nil {
log.Fatal(err)
}
return
}

func indexingHandler(config *Configuration, logger *log.Logger) http.HandlerFunc {
return func(response http.ResponseWriter, request *http.Request) {
// verify that the remote host is in whitelist
Expand Down Expand Up @@ -154,6 +163,7 @@ func main() {

// define routes
mux.Handle("/item/", indexer)
mux.HandleFunc("/status/", statusHandler)

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

0 comments on commit 77893a7

Please sign in to comment.