问HN:2024年单页应用(SPA)与服务器端渲染(SSR)哪个更好?
我正在进行一个新项目,后端的内容处理水平合理,但并不算太重。我的默认方案是使用一个简单的单页面应用(SPA),静态服务,并配备一个CRUD后端,可能会选择FastAPI和Svelte。不过,我听说很多人赞扬更多服务器端渲染(SSR)的优势,因为边缘计算技术的进步。很多人似乎倾向于将他们的后端部署在Cloudflare Workers或类似的服务上,并在那里处理。你们对这两种方式有什么经验?
对于一个大团队来说,拥有统一的前端和后端似乎更方便,而人们似乎也喜欢SvelteKit,但我个人并不介意将两者分开。我也能看到使用TypeScript/Prisma/Zod相较于SQLAlchemy和Pydantic的优势;Pydantic在一定程度上改善了Python,加上Mypy/Pyright,但类型系统仍然显得有些生硬。此外,使用SSR似乎会稍微增加我的托管费用,因为SSR将工作转移到服务器上,而Workers或类似服务通常比VPS的费用更高。谢谢!
查看原文
I'm working on a new project that has a reasonable level of content/processing done on the backend but nothing too heavy. My default approach would be a simple SPA served statically with a CRUD backend, probably fastapi and svelte. However, I've heard lots of people extoll the advantages of more SSR due to better edge compute technologies. Lots of people seem predisposed to throw their backend on cloudflare workers or something and handle it there. What are y'all's experiences between the two?<p>It seems marginally more convenient for a large team to have a unified front/backend and people seem to like sveltekit, but it doesn't personally bug me to have the two separated. I could also see advantages to typescript/prisma/zod for instance over sqlalchemy and pydantic; pydantic improves python a bit along with mypy/pyright but typing is still very much hacked-in. It also seems like I'd increase my hosting bill a bit, both because SSR shifts work to the server and because workers or similar services generally have markups over a VPS. Thanks :)