Default template for new functions is misleading and not encouraging best practices
When a new function template is created (new project or just a new function), from CLI or VS Code extension, by default it's configured to respond to GET and POST requests, which is confusing for many newcomers and annoying for experienced users.
You rarely want to write such a function beyond an hello world example, as you usually prefer to have one function per verb (and it's also a best practice to my knowledge).
I've received confused feedbacks from new users that weren't sure whether they should implement all their CRUD logic within the same function because of that, as it being the default somehow implies this should be the way to go, which is wrong.
What about considering making the default function template use a single verb (GET) to avoid this confusion?
Hi Sinedied,
I totally agree with you. The default template encourages bad practices as you may think the way to go for Microsoft when you write an API is to do something like this
if (req.Method == HttpMethod.Post) {
...
} else if (req.Method == HttpMethod.Get) {
...
}
Also, not sure if there is an official guideline for function naming (like tasks-get, task-post, task-get, etc) but if you want to use good practices with 1 function per HTTP verb, you usually end up adding a route in all your functions.json
cc: @anthonychu , @fabiocav: Any thoughts on this?
This is reasonable. @anthonychu any concerns? I'll have this added to the engineering backlog, but it would be good to get your input.
@AnatoliB FYI, if we do this, ideally, this would apply to all languages.
+ @ggailey777 for impact on docs