Skip to content

Instantly share code, notes, and snippets.

@glynnbird
Created July 4, 2015 06:58
Show Gist options
  • Save glynnbird/5175574163e38bf3693f to your computer and use it in GitHub Desktop.
Save glynnbird/5175574163e38bf3693f to your computer and use it in GitHub Desktop.
Adding a virtual host to Cloudant via the API from the Node.js library using a custom request
var cloudant = require("cloudant")("https://MYUSER:MYPASSWORD@MYUSER.cloudant.com");
var obj = {
method: "POST",
path: "_api/v2/user/virtual_hosts",
body: { host: "vhost.glynnbird.com"}
};
cloudant.request(obj, function(err, data) {
// null { ok: true }
console.log(err,data);
})
@Esauromano
Copy link

Is this correct? body: { host: "vhost.glynnbird.com"} where does it says the path to the rewrite function?

@glynnbird
Copy link
Author

you can supply a path too { host: "vhost.glynnbird.com", path: "/mypath"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment