I sometimes hear about making web-site fully API based, meaning that even in browser the page is constructed based on API endpoint and practically nothing else.
One of the benefits I see in this is that when you will make smartphone application you already have API that works and tested. And in case you need to change something you can change desktop and mobile app practically at the same time(with some tweaks maybe).
Maybe I somehow misunderstood the idea, but I have some questions about the whole viability of it. Unfortunately I couldn't find any good article on this topic(which is strange, maybe it is because this is not what people do and I just misunderstood it completely).
Just for example to be clear about the scope lets say we are building social-network-ish site.
- For mobile development API is the default way, but for desktop it seems to be overkill for me. I am used to Django framework and you can do page rendering quite easily - browser sends GET or POST request with parameters and you render a response page, can not be easier. But if I decide to use API on desktop browser then instead of simple request I need to construct JSON, send it to API endpoint, deserialize it and then render a response. And unlike with usual way, where I can generate very complex response in one step - with API endpoints I may actually need to use several endpoints to generate desktop webpage with lots of content, i.e. I end up sending multiple API requests. So by using API for everything on desktop version of the site I increase the number of requests to the server and also the amount of code needed. Yes, I will save time developing mobile app, but at the cost of increased bandwidth and decreased robustness, which is not alright in my opinion. Maybe I don't get something, would be nice if somebody can explain.
- Does it really make sense to do desktop version relying on API endpoints everywhere? I've seen people talk about it sometimes, but I have never seen any examples or big articles about it, which suggests to me that maybe this is indeed a stupid idea and I am wasting my time even thinking about it. Does anybody really make big desktop website where every little thing is tied to API endpoints? I may be not very experienced, but as far as I know on it is usually small API calls when they are helpful, but not the whole structure relies on API(unlike in mobile apps). So should I stick to usual development and leave API almost exclusively to mobile apps?