You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 11, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,11 +38,11 @@ This is the official Cloudant library for Node.js.
38
38
39
39
The best way to use the Cloudant client is to begin with your own Node.js project, and define this work as your dependency. In other words, put me in your package.json dependencies. The `npm` tool can do this for you, from the command line:
40
40
41
-
$ npm install --save cloudant
41
+
$ npm install --save @cloudant/cloudant
42
42
43
43
Notice that your package.json will now reflect this package. Everything is working if you can run this command with no errors:
@@ -53,7 +53,7 @@ Initialize your Cloudant connection by supplying your *account* and *password*,
53
53
54
54
~~~js
55
55
// Load the Cloudant library.
56
-
var Cloudant =require('cloudant');
56
+
var Cloudant =require('@cloudant/cloudant');
57
57
58
58
var me ='nodejs'; // Set this to your own account
59
59
var password =process.env.cloudant_password;
@@ -89,7 +89,7 @@ Here is simple but complete example of working with data:
89
89
require('dotenv').load();
90
90
91
91
// Load the Cloudant library.
92
-
var Cloudant =require('cloudant');
92
+
var Cloudant =require('@cloudant/cloudant');
93
93
94
94
// Initialize Cloudant with settings from .env
95
95
var username =process.env.cloudant_username||"nodejs";
@@ -129,7 +129,7 @@ You can find a further CRUD example in the [example](https://github.com/cloudant
129
129
130
130
### Initialization
131
131
132
-
To use Cloudant, add `require('cloudant')` in your code. In general, the common style is that `Cloudant` (upper-case) is the **package** you load; whereas `cloudant` (lower-case) is your connection to your database (i.e. the result of calling `Cloudant()`).
132
+
To use Cloudant, add `require('@cloudant/cloudant')` in your code. In general, the common style is that `Cloudant` (upper-case) is the **package** you load; whereas `cloudant` (lower-case) is your connection to your database (i.e. the result of calling `Cloudant()`).
133
133
134
134
You can initialize your client in _one_ of the following ways:
135
135
@@ -138,7 +138,7 @@ You can initialize your client in _one_ of the following ways:
138
138
You can initialize Cloudant with a URL:
139
139
140
140
~~~js
141
-
var Cloudant =require('cloudant')
141
+
var Cloudant =require('@cloudant/cloudant')
142
142
var cloudant =Cloudant("http://MYUSERNAME:MYPASSWORD@localhost:5984");
143
143
~~~
144
144
@@ -149,14 +149,14 @@ var cloudant = Cloudant("http://MYUSERNAME:MYPASSWORD@localhost:5984");
149
149
You can just pass your account name and password (see the [security note](#security-note) about placing your password into your source code).
150
150
151
151
~~~js
152
-
var Cloudant =require('cloudant');
152
+
var Cloudant =require('@cloudant/cloudant');
153
153
var cloudant =Cloudant({account:me, password:password});
154
154
~~~
155
155
156
156
By default, when you connect to your cloudant account (i.e. "me.cloudant.com"), you authenticate as the account owner (i.e. "me"). However, you can use Cloudant with any username and password. Just provide an additional "username" option when you initialize Cloudant. This will connect to your account, but using the username as the authenticated user. (And of course, use the appropriate password.)
157
157
158
158
~~~js
159
-
var Cloudant =require('cloudant');
159
+
var Cloudant =require('@cloudant/cloudant');
160
160
var me ="nodejs"; // Substitute with your Cloudant user account.
161
161
var otherUsername ="jhs"; // Substitute with some other Cloudant user account.
162
162
var otherPassword =process.env.other_cloudant_password;
You can initialize Cloudant directly from the `VCAP_SERVICES` environment variable. Just pass `vcapServices` and your `vcapInstanceName` (or alias `instanceName`) in the client configuration:
189
189
190
190
~~~js
191
-
var Cloudant =require('cloudant');
191
+
var Cloudant =require('@cloudant/cloudant');
192
192
var cloudant =Cloudant({ vcapInstanceName:'foo', vcapServices:JSON.parse(process.env.VCAP_SERVICES) });
193
193
~~~
194
194
@@ -203,7 +203,7 @@ You can optionally provide a callback to the Cloudant initialization function. T
203
203
Here is a simple example of initializing asynchronously, using its optional callback parameter:
204
204
205
205
~~~js
206
-
var Cloudant =require('cloudant');
206
+
var Cloudant =require('@cloudant/cloudant');
207
207
var me ='nodejs'; // Replace with your account.
208
208
var password =process.env.cloudant_password;
209
209
@@ -391,7 +391,7 @@ Use the authorization feature to generate new API keys to access your data. An A
391
391
### Generate an API key
392
392
393
393
~~~ js
394
-
var Cloudant = require('cloudant');
394
+
var Cloudant = require('@cloudant/cloudant');
395
395
var me = 'nodejs'; // Replace with your account.
396
396
var password = process.env.cloudant_password;
397
397
var cloudant = Cloudant({account:me, password:password});
@@ -458,7 +458,7 @@ See the [Authorization] documentation for further details.
458
458
To use an API key, initialize a new Cloudant connection, and provide an additional "key" option when you initialize Cloudant. This will connect to your account, but using the "key" as the authenticated user. (And of course, use the appropriate password associated with the API key.)
459
459
460
460
~~~ js
461
-
var Cloudant = require('cloudant');
461
+
var Cloudant = require('@cloudant/cloudant');
462
462
var cloudant = Cloudant({account:"me", key:api.key, password:api.password});
0 commit comments