Skip to content

Fix api.md typo & code style #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ That's right, CouchDB is more than a database: it's also a RESTful web server wi

And best of all, CouchDB does it with good ol'-fashioned HTTP. Just open up the network tab and watch the JSON fly back and forth.

To get started, just install CouchDB, throw in [a little SSL](https://wiki.apache.org/couchdb/How_to_enable_SSL), and you've got everything you need for your site's authentication.
To get started, just install CouchDB, throw in [a little SSL](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=48203146), and you've got everything you need for your site's authentication.

### Project status

Expand Down
24 changes: 12 additions & 12 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ API
Like PouchDB, every function takes a Node-style callback of the form `function(error, response)`. Or you can use promises:

```js
db.doSomething(args).then(function (response){
db.doSomething(args).then(function (response) {
return db.doSomethingElse(args);
}).then(function response) {
}).then(function (response) {
// handle response
}).catch(function (error) {
// handle error
Expand Down Expand Up @@ -77,7 +77,7 @@ db.signUp('robin', 'dickgrayson', {

Note that CouchDB does not enforce a password policy or a username policy, unless you add a security doc to the `_users` database.

#### db.logIn(username, password [, options] [ callback])
#### db.logIn(username, password [, options] [, callback])

Log in an existing user. Throws an error if the user doesn't exist yet, the password is wrong, the HTTP server is unreachable, or a meteor struck your computer.

Expand Down Expand Up @@ -119,7 +119,7 @@ db.logOut(function (err, response) {
{"ok":true}
```

#### db.getSession([opts] [, callback])
#### db.getSession([options] [, callback])

Returns information about the current session. In other words, this tells you which user is currently logged in.

Expand Down Expand Up @@ -157,7 +157,7 @@ db.getSession(function (err, response) {

**Note:** `getSession()` returns basic user information, like name and roles, but doesn't return metadata. If you need the metadata, use `getUser()`.

#### db.getUser(username [, opts][, callback])
#### db.getUser(username [, options] [, callback])

Returns the user document associated with a username. (CouchDB, in a pleasing show of consistency, stores users as JSON documents in the special `_users` database.) This is the primary way to get metadata about a user.

Expand Down Expand Up @@ -196,7 +196,7 @@ db.getUser('aquaman', function (err, response) {
**Note:** Only server admins or the user themselves can fetch user data. Otherwise you will get a 404 `not_found` error.


#### db.putUser(username, opts [, callback])
#### db.putUser(username [, options] [, callback])

Update the metadata of a user.

Expand All @@ -212,7 +212,7 @@ db.putUser('robin', {
});
```

#### db.deleteUser(username, opts [, callback])
#### db.deleteUser(username [, options] [, callback])

Delete a user.

Expand All @@ -222,7 +222,7 @@ db.deleteUser('robin', function (err, response) {
});
```

#### db.changePassword(username, password [, opts][, callback])
#### db.changePassword(username, password [, options] [, callback])

Set new `password` for user `username`.

Expand All @@ -244,12 +244,12 @@ db.changePassword('spiderman', 'will-remember', function(err, response) {
// "rev": "2-09310a62dcc7eea42bf3d4f67e8ff8c4"
// }
}
})
});
```

**Note:** Only server admins or the user themselves can change user data. Otherwise you will get a 404 `not_found` error.

#### db.changeUsername(oldUsername, newUsername[, opts][, callback])
#### db.changeUsername(oldUsername, newUsername [, options] [, callback])

Renames `oldUsername` to `newUsername`.

Expand All @@ -268,7 +268,7 @@ db.changeUsername('spiderman', 'batman', function(err) {
} else {
// succeeded
}
})
});
```

**Note:** Only server admins change a username. Otherwise you will get a 404 `not_found` error.
Expand All @@ -283,7 +283,7 @@ db.signUpAdmin('batman', 'brucewayne', function (err, response) {
});
```

#### db.deleteAdmin(username, opts [, callback])
#### db.deleteAdmin(username [, options] [, callback])

Delete an admin.

Expand Down