告诉我为什么我不应该这样做:Sinatra API with Full JS/HTML Frontend
我即将设计一个必须能够处理大量用户的社交网站。
我想这样设计它:
- Sinatra 位于后端,具有完整的 REST api,用于执行网站上的所有操作
- JQuery/HTML 前端 Web 应用程序专门与 REST API 通信
这样,我只需制作一个其他应用程序(iPhone、Android)应用程序将与之通信的中央 API。
此外,服务器上的负载似乎会减少,因为服务器只需要提供最少量的信息,而其他一切都在客户端完成。
为什么更多的网站没有这样做呢?
为什么我不想这样做?对我来说这似乎是个好主意......
I'm about to be designing a social website that must be able to handle a high volume of users.
Here's how I want to design it:
- Sinatra on the backend with a full REST api to do all of the operations on the website
- JQuery/HTML front end web app that communicates exclusively with the REST API
In this way, I only have to make one central API that other apps (iPhone, Android) app will communicate with.
Also, it seems like it will be less load on the server, since the server only has to serve the minimum amount of info and everything else is done client side.
How come more sites aren't done this way?
Why wouldn't I want to do this? It seems like a good idea to me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
因为它是 脆弱,搜索引擎不会索引您的内容。
Because it is fragile and search engines won't index your content.
37signals 正在为这种架构开发一个名为 Cinco 的框架:
http://thinkvitamin.com/code/javascript/37signals-cinco-framework-to-be-open-sourced/
但是如果你只坚持使用 jQuery,我想你会错过一个在使用框架时,很多事情你认为是理所当然的,但你可能必须重新实现它们。但这实际上取决于您的应用程序。
37signals are working on a framework called Cinco for this kind of architecture:
http://thinkvitamin.com/code/javascript/37signals-cinco-framework-to-be-open-sourced/
But if you stick to just jQuery I think you'd miss a lot things you take for granted when using a framework, which you might have to re-implement. But it really depends on your app.
在没有 JS 的情况下获得基本功能并不太难,然后将 Ajax 内容添加到您的应用程序中。例如 - 您可以创建 API 以响应纯 html 标记并响应 JSON。
我喜欢用 JS\ajax 围绕 API 完成所有工作,新技术可能更简单、更优雅,它为您提供更多功能,但即使是 google 现在也无法索引完整的 ajax 站点。
读:
http://www.google.com/support/webmasters/bin /answer.py?answer=81766
It's not too hard to get basic functionality without JS, and after add Ajax stuff to your application. For example - you can create your API to respond as plain html markup and to respond JSON.
I like idea to do all stuff around API with JS\ajax, it maybe easy and more elegant with new technologies, it giving you more capabilites, but even google can't indexing full ajax sites now.
Read:
http://www.google.com/support/webmasters/bin/answer.py?answer=81766