DEV Community

Discussion on: Unit testing frontend code is (probably) useless

 
brense profile image
Rense Bakker

I never said all business logic should be in the client. The data model is also business logic, I specifically said to define the data model on the server... Also yes, there are definitely ways to send emails from the FE, not saying you should always opt to go that route, but its certainly possible... Serverless is a thing in 2022.

Thread Thread
 
polterguy profile image
Thomas Hansen AINIRO.IO • Edited

Serverless has about as much to do with frontend/backend business logic as CosmosDB has to do with SQL. Serverless is a method to create HTTP Web API methods (mostly, ignoring timer functions of course) that is (often) implemented as Kubernetes PODs, dynamically orchestrated on a "per needs basis" - I should know, we've basically implemented our ENTIRE COMPANY around the axiom ... :/

In fact, you can even have a "serverless application" without even having a frontend ...

However, you CANNOT get away from having "a server", the point about "your server" though is that it's not a statically scheduled server that is "only yours", it's a technology typically built upon Kubernetes allowing your cloud provider to orchestrate and schedule execution on a "per need" basis, using stuff such as K8s replicas, sleeping containers, etc ...

If you believe that "serverless" is about "not having backends, but putting all your business logic in the frontend" I would recommend you read up on the subject ...

Thread Thread
 
brense profile image
Comment deleted
Thread Thread
 
polterguy profile image
Thomas Hansen AINIRO.IO

serverless functions are a thing and serverless functions can send emails

Serverless functions are backend code! You're the one who's changing the subject ...

Check up Azure Functions or Lambda Functions with AWS before you make a fool out of yourself here ...

Thread Thread
 
brense profile image
Rense Bakker

I never told anyone not to write backend code. I said most business logic resides in the frontend nowadays and that backends are typically only used to define a data model and do authentication.

We have a real problem here though:

A: According to you, emails have something to do with business logic? Or why else did you bring it up?

B: Serverless functions have nothing to do with business logic (your words)

C: Fact: you can send emails with serverless functions

A, B and C can't all be true... So what's it gonna be? Either A or B has to be false since C is a fact. Or are you one of those people who believe in alternative facts and you're just going to ignore the fact that you can send emails with serverless functions?

Also, there's a lot of other ways to deploy serverless functions besides Azure or AWS.

Thread Thread