Nate
Nate

Reputation: 331

Serving static HTML from CouchDB

I've got a CouchDB server up and running serving basic API requests. Overall it works well because users can GET/POST/PUT etc. to the host 'api.example.com'. The only issue is that if a user does a GET request for '/', they get the {"couchdb":"Welcome","version":"1.0.2"}.

Is there anyway to serve a single static HTML page or even an HTTP redirect for the root? That way I could redirect users to the API documentation.

I'm vaguely familiar with Couchapp but it seems like overkill for such a simple task.

Thanks!

Upvotes: 3

Views: 471

Answers (1)

JasonSmith
JasonSmith

Reputation: 73702

You probably want a vhost/rewrite rule. They are pretty easy. Basically you tell CouchDB that queries to "www.example.com" should go directly to the rewriter. The rewriter will serve anything that you specify in the design document.

Jan Lehnardt wrote up good instructions in the Couchbase blog post, Nice URLs.

Upvotes: 3

Related Questions