Browse Source

Merge pull request #131 from cdock1029/master

Add / to root request. Temp fix #101
master
Nicolas Garnier 8 years ago
committed by GitHub
parent
commit
8dbc45bfc6
  1. 12
      authorized-https-endpoint/functions/index.js

12
authorized-https-endpoint/functions/index.js

@ -56,5 +56,13 @@ router.get('*', (req, res) => {
// This HTTPS endpoint can only be accessed by your Firebase Users.
// Requests need to be authorized by providing an `Authorization` HTTP header
// with value `Bearer <Firebase ID Token>`.
// NOTE: You need to add a trailing slash to the Function's URL becasue of this issue: https://github.com/firebase/firebase-functions/issues/27
exports.authorizedHello = functions.https.onRequest(router);
exports.authorizedHello = functions.https.onRequest((req, res) => {
// NOTE: You need to add a trailing slash to the root URL becasue of this issue: https://github.com/firebase/firebase-functions/issues/27
// without trailing "/", req.path = null, req.url = null
// won't match to your app.get('/', ...) route
if (!req.path) {
// prepend to keep query, path params
req.url = `/${req.url}`
}
return router(req, res)
});

Loading…
Cancel
Save