bemily-database

Wrapper for database access

Usage no npm install needed!

<script type="module">
  import bemilyDatabase from 'https://cdn.skypack.dev/bemily-database';
</script>

README

bemily-database

CouchDB views

'user/user'

This view display all user information.

function(doc) {
 if(doc.type == 'user') {
   emit(doc._id, {
    _rev: doc._rev,
    picture: doc.picture,
    name: doc.name, 
    surname: doc.surname,
    mail: doc.mail,
    major: doc.major,
    semester: doc.semester,
    subscribed_groups: doc.subscribed_groups,
    password: doc.password
    });
 }
}

'user/login'

View to display login information.

function(doc) {
 if(doc.type == 'user') {
   emit(doc._id, {
    password: doc.password
   });
 }
}

Tests

Tests can be run with npm test or make test, make test-cov and test-cov-html. Note: npm test points to make test-cov. This is inspired from many hapi plugins.