网站架构问题
如果我们网站的后端通过 API 公开(安全等),那么仅使用 JQuery 开发网站是一个好主意吗?
正如一位评论者所说,JQuery 将调用 API。
再次编辑:这背后的整个想法是实现可扩展性。例如,相同的 API 可以用于移动设备或其他设备。
If our website's backend is expose via apis (secured and everything) , is it a good idea to develop the website only in JQuery?
Like one commenter said, JQuery will be calling the API's.
Edit again: The entire idea behind this is to achieve scaleability. For example, the same api's could then be used on Mobile or something else.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
jQuery 只是一个java 脚本框架。它与将你的后端暴露为 api 无关。
*编辑*
在查看其他人的回复后,您可能正在谈论仅为后端已公开为 API 的 Web 应用程序开发前端。您可以使用 jQuery 来做到这一点。但它肯定对搜索引擎不友好,无法完全访问,并且对于没有启用 JavaScript 的人来说不可用。
jQuery is only a java script framework. It has nothing to do with exposing your backend as api's.
*EDIT*
After looking at other peoples response, may be you are talking about developing the front end only for a web application whose back end is already exposed as api's. In that you can do that using jQuery. But it would definitely be not a search engine friendly and not accessible completely and not usable for people who don't have javascript enabled.
如果您询问是否可以开发一个完整的客户端应用程序,使用 jQuery(或任何与此相关的 Javascript)通过 AJAX 等调用所有后端 API,那么您当然可以。
但我不推荐它,因为对于禁用 Javascript 的用户来说,它会完全削弱您的整个网站。
If you're asking whether you can develop a complete client-side application that uses jQuery (or any Javascript for that matter) to call all of your back-end APIs via AJAX, etc, you certainly could.
I wouldn't recommend it though, as it would completely cripple your entire site for users with Javascript disabled.
只是将其留在这里,但不久前我读了一篇关于您正在处理的问题的不错的博客文章。
查看:http://omergertel.com/2010/08/05/网站上的 API/
Just leaving this here, but a while ago I read a nice blog post about the very issues you are dealing with.
Check it out: http://omergertel.com/2010/08/05/on-websites-apis/
如果网站的主要目的是向世界展示内容,那么我强烈建议不要采用这种方法。您不仅会锁定不能或不会启用 javascript 的用户(例如音频浏览器、使用非常非常旧的软件的人、次智能手机移动设备等),还会有效地向搜索引擎隐藏您的所有内容。
然而,如果它是一个类似 Web 2.0 的东西,更像是一个实际的应用程序而不是一个内容呈现的网站,那么用 javascript 对其进行编程可能是一个可行的解决方案 - 但同样,您将错过搜索引擎点击和 javascript - 不可知的用户。
另外,请注意,没有什么可以阻止您从服务器端演示代码(ASP.NET、PHP、JSP,无论您喜欢什么)调用 api。
If the website's primary purpose is to present content to the world, then I'd strongly advise against such an approach. Not only will you lock out users who cannot or will not enable javascript (think audio browsers, people with really really old software, sub-smartphone mobile devices, etc.), you will also effectively hide all your content from search engines.
If, however, it's a web 2.0-ish thing that resembles an actual application more than a content-presenting web site, then programming it in javascript might be a viable solution - but again, you'll miss out on search engine hits and javascript-agnostic users.
Also, note that there is nothing stopping you from calling your api's from server-side presentation code (ASP.NET, PHP, JSP, whatever you fancy).
围绕 API 开发 Web 应用程序有多种选择。 JQuery 只是一种选择。答案取决于您想要实现的目标......
there are many options for developing a web application around an API. JQuery is only one option. The answer depends on what you are trying to accomplish...