Deploying functions to "subdirectories"

Hello,

I'm trying to get started with Firebase functions. Deploying functions to...

https://MY_REGION-MY_PROJECT_ID.cloudfunctions.net/FUNCTION_NAME

...is working well. However, what I'd like to do is deploy to:

https://MY_REGION-MY_PROJECT_ID.cloudfunctions.net/v2/FUNCTION_NAME

I think I've done a reasonable job of reading through the documentation, but I haven't been able to find how to do this. Any assistance/advice?

Thank you.

(P.S. Would GitHub be a better place to ask for help?)

Posted Oct 21, 2019, 7:03 PM UTC

43
Pizza_Fox•

If you write your functions using the Express framework (or something else, but Express is especially supported) you can accomplish this.

2
murdocc•

Agreed, this is the tutorial i followed to get a basic foundation together successfully. It's a good start:

https://itnext.io/running-express-js-on-firebase-cloud-functions-a20b536c6aec

2
kossnocorp•

You can achieve it by using Express as it was suggested in other comments, but then you'll have one single function for everything which might make debugging hard.

You also can use hosting rewrites and route functions yourself, see: https://firebase.google.com/docs/hosting/functions

1