New blog post: "The balance has shifted away from SPAs" nolanlawson.com/2022/05/21/the

Just some random thoughts on why it seems like people are turning on SPAs recently. I suspect it's less of a pendulum swing in popular opinion and more because the underlying browser technology has changed.

@nolan Another thing MPAs don't do (and probably never will): serve apps without the server-side hassle. There are many services and ways to host static apps easily and for free (it's arguable whether this is good, but it lowers the barrier of entry). But as soon as you need a server component, things get a lot more complicated. Building it this way also makes apps more portable.

Maybe I'm mistaken about the hassle of server-side computing though? That's been my experience at least.

@noeldemartin Yeah you're right, that's a good point. It's part of the reason Pinafore is an SPA. I like just hosting static files and being done with it. It preserves privacy as well that I don't need to handle server-side user data.

OTOH you could build an "MPA" where most of the logic lives in a service worker, there's no client-side router, and it would still be purely static files. Not sure I've seen a great implementation of this though.

@nolan Yeah I also thought of something like that, but I guess you can't have dynamic urls, right? You have to resort to using query parameters or url fragments.

@noeldemartin Sure you can. The service worker can intercept any HTTP request and respond with whatever it wants.

Follow

@nolan But wouldn't you need to have an html file with that name? For example, if I'm trying to have the url /user/123456, don't I need to have a /user/123456.html static file?

Maybe this can be worked around if the server allows you to customize the 404 html, and implement your thing in there. But the status code would still be a 404 I think, right?

Well in any case, regardless of it being possible or not I think we'd agree that by that point the complexity is not too far from doing an SPA :)

Sign in to participate in the conversation
Noel's Mastodon

This is an instance-of-one managed by Noel De Martin.