Skip to content

Commit

Permalink
fix: error handling in hello-container
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed May 24, 2018
1 parent dc9cd9f commit f778fe9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/hello-world/services/hello-container/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ const request = require("request-promise")

const app = express()

const functionEndpoint = process.env.GARDEN_SERVICES_HELLO_FUNCTION_ENDPOINT

app.get("/hello", (req, res) => {
// Query the example cloud function and return the response
request.get(process.env.GARDEN_SERVICES_HELLO_FUNCTION_ENDPOINT)
request.get(functionEndpoint)
.then(response => {
res.send(response + "\n")
})
.catch(() => {
res.statusCode = 500
res.send("Unable to reach function at " + functionEndpoint + "\n")
})
})

// This is the path GAE uses for health checks
Expand Down

0 comments on commit f778fe9

Please sign in to comment.