News for hackers. Stuff that matters.
Re:None of my projects want to be SPAs by hombre_fatal on Monday February 11, 2019 @12:03PM (#19135946)
Well, SPAs are attractive even for websites that don't particularly benefit from them because of the technical attractiveness of having the website be like any other client that consumes your server's API.
Re:None of my projects want to be SPAs by bryanrasmussen on Monday February 11, 2019 @12:20PM (#19136125)
sure but there are very few websites in the world that need to publicize an api, basically only sites that need to be able to function as applications. once you have a site that needs to be an application arguing for it to be single page is not that great a leap.
Re:None of my projects want to be SPAs by hombre_fatal on Monday February 11, 2019 @12:26PM (#19136182)
Sure, I meant to make the point that developers are drawn to SPAs for more understandable reasons than just being a bunch of lemmings.

Also, it's hard to realize how much work a SPA actually entails until you get your hands dirty. SPAs generally sound great on paper from a technical standpoint.

Re:None of my projects want to be SPAs by quonn on Monday February 11, 2019 @01:24PM (#19136792)
If you have a mobile app, you need an API, even if you‘re site does not function as an application.
Re:None of my projects want to be SPAs by rossdavidh on Monday February 11, 2019 @01:44PM (#19137052)
The great majority of websites, though, DON'T need a mobile app; they need a website that works on mobile. Most smartphone users are unwilling to download more than a few apps for websites, anyway; if your website is a restaurant, a news source, or anything else that works well on a website, most users are unwilling to download and install your app anyway. So, if you want their business, you need to make your website work for mobile. Once you have done, that, in most (not all) cases, you don't need to develop an app anyway.
Re:None of my projects want to be SPAs by theonething on Monday February 11, 2019 @06:33PM (#19139594)
unless you use Turbolinks with IOS/Android adapters or another hybrid app alternative
Re:None of my projects want to be SPAs by em-bee on Monday February 11, 2019 @03:10PM (#19137808)
exactly that. since 2012 i build all my websites as SPAs for this reason. more so, i am not even writing any new backends. i reuse the same backend over and over. most websites (at least the ones i have been building) are just CRUD and don't really need a custom backend.

SPAs bring back the client-server architecture we had before the web. you build desktop clients that consume server-api's.

server-side html generation now feels like cruft and an awkward way of building applications.

Re:None of my projects want to be SPAs by BerislavLopac on Wednesday February 13, 2019 @08:29AM (#19152849)
It should be trivial to build a server-side client app in the same manner, using an API for any persistence instead of directly accessing the database. Most of the full-stack frameworks (Django, Rails, Laravel etc) are unfortunately still conflating the persistent state entities with business logic objects.
Re:None of my projects want to be SPAs by em-bee on Wednesday February 13, 2019 @03:13PM (#19156499)
you are of course right. there is no stopping anyone from doing that. in fact the university which initially developed the backend i am using has been doing just that, using the backend like a database, creating "frontends" in PHP.

though that doesn't negate the point of SPA which enables building clients that run directly on the users devices and are not hampered by the difficulty of emulating stateful clients on a server.

Re:None of my projects want to be SPAs by wolco on Monday February 11, 2019 @05:54PM (#19139308)
You are falling into a comfortable trap where it is easier to do the same. If you took the time to learn laravel your development time can be cut in half.
Re:None of my projects want to be SPAs by em-bee on Tuesday February 12, 2019 @12:12AM (#19141215)
the backend i have is of course written in such a framework. (it's not laravel[0], but it could be)

i am not trying to diss backend frameworks here as bad. any of these would be a good choice for the backend.

the point is that thanks to SPA and CRUD i get to reuse that same backend over and over with little or no modification. (modifications amount to fixing bugs and very rarely adding new features to the API)

my backend development time now is effectively 0!

[0] (i have been working with laravel, django and others (primarily roxen and pike) before, and while i am not a fan of php, i did find laravel pleasant to work with)

Re:None of my projects want to be SPAs by yellowapple on Monday February 11, 2019 @10:08PM (#19140663)
You can do this with a non-SPA website just fine if the website's backend is the API client. Sure, it adds an extra layer of indirection between the browser and your data, but if the separation of concerns is really your goal, then that's probably as good as it gets.
[dead]
Re:None of my projects want to be SPAs by hombre_fatal on Monday February 11, 2019 @02:33PM (#19137498)
Well, with a SPA, 0% of your website may be rendered on the server just like your other clients. That's basically the defining feature, though of course they can be rendered on the server as an optimization detail. They even still use AJAX, so I didn't quite understand that bit.

I'm not sure what you meant with the rest of your post. There are technical upsides to having zero web client presentation logic implemented on the server at all. But it's just trade-offs.

Maybe you're suggesting with your "grunt work" comment that most complexity for most applications lives in the UI rather than the API? I'd agree. It's why there are upsides to keeping UI implementation off the server.

I just like to avoid the HN cargo cults of "this = good, that = bad" and "the people who do $X are probably incompetent."