Best practices for Serverless
As we know, the serverless architecture consists of a small piece of code called a function, which runs in a stateless container. One major purpose of this architecture is to scale and descale as and when required. So, bearing this in mind, our best practices are more or less focused on this aspect of serverless. So let's look at a few of the best practices involved with the serverless concept.
One function, one task
When we start building functions, we might end up with monolithic functions behind the proxy route and use a switch
statement. So, if we have one or a few functions to run our whole app, then we are actually scaling the whole application instead of scaling a specific element of the application. This should be avoided, as scaling would be a problem in this instance, and we also might end up with large and complex functions.
Functions call other functions
We should avoid calling a function within another function because we will end up paying more for...