Skip to content

Commit

Permalink
Fix routing of REST API resources
Browse files Browse the repository at this point in the history
If the API is called via the hosting domain instead of over
`...cloudfunctions.net/api`, the path that reaches the API includes
the `/api` prefix. So we have to include that into the routes
optionally so that both calls work.
  • Loading branch information
rzueger committed Apr 19, 2020
1 parent 33c7351 commit 29597c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion functions/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ try {

api.use(cors)

api.get('/aerodrome/status', async (req, res) => {
api.get('(/api)?/aerodrome/status', async (req, res) => {
const status = await fetchAerodromeStatus(admin.database())

res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
Expand Down

0 comments on commit 29597c4

Please sign in to comment.