5
votes

I'm currently developing a small game that will rely on a lot Azure App Functions to execute function from time to time. I followed a tutorial on MSDN (https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-vs#configure-the-project-for-local-development) explaining that I had to create a new project to host a function but so far, I already have 6 different functions and I don't really want to create 6 different projects.

Moreover, all these functions (developed in JavaScript) have a lot of code in common so I created a common JavaScript file with some helper function. Now that I have multiple projects, I can't use it anymore without copy/pasting it in all projects.

Finally, to be able to correctly develop the game, all the functions must be running in parallel on my development machine and I don't really want to open 6 (or more in the future) powershell instances to host these functions.

Is there a way to host multiple functions in the same project and deploy them easily on Azure ?

1
I edited the OP - ssougnez
Can you review the approach described here? It shows how the some JavaScript code can be shared between functions. stackoverflow.com/questions/44612507/… - mybrave
You could also run them as web jobs in an app. Then it would be possible to deploy one app to azure web app with multiple projects to web jobs. - Marcus Höglund

1 Answers

5
votes

That's what Function Apps are for. Each Function App may contain multiple Functions, which will be deployed together.

You mention Javascript, but the linked tutorial is in C#. Regardless, you can put multiple functions into the same app: subfolders under the same root (where host.json file is), or static methods in the same C# project. Each function will have a separate function.json file. All functions can share the same code.