使用CouchDB提供HTML [英] Using CouchDB to serve HTML
问题描述
我正在尝试将CouchDB与HTML/独立REST体系结构一起使用.也就是说,除了CouchDB和ajax样式的javascript调用CouchDB之外,没有其他应用程序服务器.
I'm trying to use CouchDB with HTML/standalone REST architecture. That is, no other app server other than CouchDB and ajax style javascript calling CouchDB.
跨脚本似乎是一个问题.我以前使用过Cloudkit/Tokyo Cabinet,看来所需的回调函数正在将其固定在URL中.
It looks like cross scripting is a problem. I was using Cloudkit/Tokyo Cabinet before and it seems like the needed callback function was screwing it up in the URL.
现在我正在尝试CouchDB并遇到相同的问题.
Now I'm trying CouchDB and getting the same problem.
这是我的问题:
1)是否存在这些问题,因为REST/JSON存储(例如CouchDB或CloudKit)在与我的网页不同的端口上运行?它们都在本地运行,并从本地主机"调用.
1) Are these problems because the REST/JSON store like CouchDB or CloudKit is running on a different port from my web page? They're both run locally and called from "localhost".
2)我应该让CouchDB托管我的页面并提供HTML吗?
2) Should I let CouchDB host my page and serve the HTML?
3)我该怎么做?该文档似乎不太清楚...
3) How do I do this? The documentation didnt seem so clear...
谢谢, 亚历克斯
推荐答案
有一个简单的答案:将静态HTML存储为CouchDB文档的附件.这样,您可以直接从CouchDB提供HTML.
There is a simple answer: store static HTML as attachments to CouchDB documents. That way you can serve the HTML directly from the CouchDB.
有一个命令行工具可以帮助您完成此任务,称为 CouchApp
There is a command-line tool to help you do this, called CouchApp
链接到Mike的书也有一章(管理设计文档)说明了如何使用CouchApp可以做到这一点.
The book Mikeal linked to also has a chapter (Managing Design Documents) on how to use CouchApp to do this.
这篇关于使用CouchDB提供HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!