1
votes

I use an Express app on cloud functions deployed with the Firebase CLI. What is the way to deploy only one specific function?

const app = express();

app.post('/sample-1', (req, res) => {
  //
});

app.post('/sample-2', (req, res) => {
  //
});

when I try:

firebase deploy --only functions:app

it deploys all app functions (sample-1, sample-2 ... )

Is there a way to deploy only a specific Eexpress app function like sample-1 ?

2

2 Answers

2
votes

No, there is not. The entire express app will be updated every time. In the end, it is really just one function that has internal routing for each path.

0
votes

You cannot deploy only sample-1 or sample-2 because both are in app, although you make make another instance of express() -> const appv2 = express(); or something like that to export it in the end but you have to measure you benefit of all that.

const app = express();
const appV2 = express();

app.post('/sample-1', (req, res) => {
  //
});

appV2.post('/sample-2', (req, res) => {
  //
});