TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How to design an entirely client-side generated website

4 点作者 fgielow大约 13 年前
Hello!<p>I would like to know if it is possible to build a website in a way that it depends only in the javascript running on the client-side, considering the needs specified below.<p>I want to have a server only to serve files, and then the content of the website itself would all be obtained and generated by the client browser, no server-side programming at all. I want to use amazon s3 for hosting the files.<p>Then, I would need to have a "public" database which could be read by anyone without any login, so I could retrieve all my data from there securely through javascript. I do not want a server listening for AJAX requests or anything like that, as I would still need to do some specific server-side programming there. Is there any possibility of using online available databases in a public way, easily and securely retrievable through a client-side javascript request? Something like amazon RDS or MongoHQ would be great, but I do not know if it is possible.<p>I do not know much advanced stuff regarding these topics, I am sorry if this is too obvious or if I did not make much sense.<p>Thanks in advance.

4 条评论

fgielow大约 13 年前
Thanks for the replies so far!<p>I will give it a try today later. If I find any nice solutions I will give feedback.<p>When I thought of doing this I thought: "Why haven't I seen this before?", as it seems so feasible, but I never really read many discussions regarding this topic. Anyways, I do not dive in web programming too much, there may exist some solutions already.<p>I see that much of the programming that is done on the server-side could be done in the client-side with no collateral effects at all, if some cares were correctly taken!<p>Going even further, is there a way to securely manipulate remote databases through javascript? Maybe have a pair of asymmetric keys on the client-side/server-side (this server-side would be of the third party that offers the service, not mine) so I can authenticate the user at the server side. The client would then have to send this key with the operation he wants to perform in the database. If he has access, the operation is performed. Otherwise, it isn't.<p>Again, I do not know much about these topics. Maybe it is already done and I don't know. If you guys know of something like what I am saying, please let me know. It seems that it should not be very difficult to achieve these things in practice.
aespinoza大约 13 年前
I think you should be able to do it.<p>You can access S3 using this: <a href="http://code.google.com/p/js3db/" rel="nofollow">http://code.google.com/p/js3db/</a><p>MongoHQ has a REST API, so calling it from Javascript should be easy. This document might help you: <a href="http://blog.mongohq.com/blog/2012/02/20/connecting-to-mongohq" rel="nofollow">http://blog.mongohq.com/blog/2012/02/20/connecting-to-mongoh...</a>
评论 #3731892 未加载
pilom大约 13 年前
I do something similar with whitewatermap.com. The problem with what you are trying (which I have run into too) is that the javascript can only access either AJAX calls on your own server (which I know you don't want to do) or access items via a url. S3 allows you to make things accessible at known URL's but it costs a lot per PUT request (relatively) so it makes databases difficult. If you find a cloud/hosted database that makes all entities accessible via URL I would be very interested too.<p>Edit: aespinoza pointed me to mongohq.com which does exactly what I wanted. I'm so happy.
dwynings大约 13 年前
Maybe this will help: <a href="https://github.com/srhyne/jQuery-Parse" rel="nofollow">https://github.com/srhyne/jQuery-Parse</a>