Azure / Azure-Functions

1.12k stars 199 forks source link

Feature: Subfolders #1240

Open iyerusad opened 5 years ago

iyerusad commented 5 years ago

Feature: Support subfolders / categories structure.

Mockup:

http://localhost:7071/api/promos
http://localhost:7071/api/promos/list
http://localhost:7071/api/promos/newest
promos/
├── function.json
├── index.js
├── list
│   ├── function.json
│   └── index.js
└── newest
    ├── function.json
    └── index.js

Existing workarounds are rather janky:

Stackoverflow request: https://stackoverflow.com/questions/44176892/azure-functions-in-sub-folders

mhoeger commented 5 years ago

cc: @ColbyTresness

orta commented 4 years ago

I ended up building multiple function apps to effectively replicate this, but now that I'm a bit further down the line - I'm probably going to move to flatten the apps into a single one and use prefixes on the names instead.

MattL-NZ commented 4 years ago

Hey @mhoeger, @ColbyTresness, can anyone confirm if this is being looked at? I would love the ability to move my typescript functions into a subfolder to make the layout a lot cleaner.

vohrahul commented 3 years ago

Upvote, this is definitely going to be very interesting to have this. Currently using the prefixes on the names.

Krucial92 commented 3 years ago

Upvote! If we could specify a folder in host.json for example "./src/functions" which could recursively look for our function.json files in that folder that would be amazing, as opposed to having 50 functions in the root folder along with everything else.

Any update here, is this on the roadmap? @mhoeger @ColbyTresness

afefer commented 3 years ago

This would be super valuable. My function app's starting to get out of hand with no way to organize them. Being able to group functions in subfolders would go a long way! @mhoeger any idea if this is being looked at?

LotfiMEZIANI commented 3 years ago

There is some news about this feature?

mogupta-ecfmg commented 3 years ago

upvote.. this feature is very much needed when working with multiple functions inside the same project.. its very difficult to manage the code otherwise.. I believe AWS already provides this feature !

flo-sch commented 3 years ago

That would make things so much simpler when working in an https://nx.dev/ workspace/monorepository, really hope this can get prioritized 🙏

LotfiMEZIANI commented 3 years ago

That would make things so much simpler when working in an https://nx.dev/ workspace/monorepository, really hope this can get prioritized 🙏

Can we develop an azure function project in nx?

I had searched last year, but there was no nx plugin for.

flo-sch commented 3 years ago

Can we develop an azure function project in nx?

There is no official plug-in but I currently manage to maintain one Function App as a nx workspace thanks to the "scriptFile" option of AF to target nx dist folder, as described here: https://github.com/Azure/azure-functions-core-tools/issues/2736 (Inspired from the TS template of Azure Functions)

It uses nx to compile and serve, and Azure Functions Core Tools (AFCT) to run locally and deploy. And since AFCT does not recommend to update only one function, the deployment publishes all functions, which means no optimized CD for that step (... but other nx targets can work with the affected scope, for instance if you also have frontend projects in the workspace)

ChuckJonas commented 2 years ago

even just being able to drop all the functions in a subfolder 1 level deep would make a big difference. That way at least you have single folder containing ONLY functions.

 functions
    - petstore-get
    - petstore-post
    - foobar-get
 lib
    - validators.ts
packet.json

Right now, I have function folders sandwiching lib and root level configuration files, which seems really disorganized.