Last active
August 29, 2015 14:08
-
-
Save tlvince/c6e242d8b2d9fa178174 to your computer and use it in GitHub Desktop.
PouchDB authentication - require_valid_user testcase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title></title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<script src="https://cdn.jsdelivr.net/pouchdb/3.0.6/pouchdb.min.js"></script> | |
<script src="https://rawgit.com/nolanlawson/pouchdb-authentication/master/dist/pouchdb.authentication.js"></script> | |
<script> | |
// Prevent nonce | |
var options = { | |
ajax: { | |
cache: true | |
} | |
} | |
var db = new PouchDB('http://localhost:5984/test'); | |
db.login('admin', 'admin') | |
.then(function() { | |
return db.allDocs(); | |
}) | |
.then(function(docs) { | |
console.log(docs); | |
}) | |
.catch(function(err) { | |
console.error(err); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment