I have been making Web apps for a while now. Mostly frontends.
I have always wanted to make fully functioning web sites, and therefore, my question.
The question might be dumb, so please bear with me...
I have realized that there are two ways I can develop web apps:
-----or-----
My question is:
Did I understand this right? Is this how webdev works?
And the more important one, WHEN TO USE WHAT? What is faster or better?
Normally I'd Google something like this, but there's either not much information about this, or more probable, I'm searching the wrong thing.
Please help me clear my concepts.
Both are correct approaches. But the first one is a more traditional approach towards web app but it comes with the difficulty of writing sensible, reusable code in it compared to writing random-looking nonsense which happens to work, along with performance and reliability issues.
Writing code with a RESTful approach is what I personally prefer. The majority of frameworks use this approach. Maintaining code between teams is easy.
Modern backends like nodejs can also throw HTML as a response(see templating engines) but as I said option 2 is always preferred.