sofajs
not ready for production -- test coverage 89%.
Build couchdb request logic using sofajs which loads all requests into a
requests object for easy consumption within your application. Plus, documentation is
generated for all requests supporting gfm.
Install
npm install sofajs
Why sofajs?
While planning for a hapijs project which used CouchDB saw something like sofajs was needed
so decided to build it.
Designs
A core concept of couchDB is orgnizing and searching your data using design documents.
sofajs supports the construction of views and update functions and generates design
documents for you. Plus, the design document builder logic supports the loading of
fixture data for each design document.
DB Connections
sofajs uses nano when making couchdb requests.
A database connection is guaranteed before requests are executed.
And, nano's database methods can be accessed using: sofaInternals.db
object.
Three types of methods
sofajs provides tools to build three types of methods: requests, tools, and promises.
- database requests methods
methods that your nodejs application will use when making a request to CouchDB.
Accessible to externally to be used by applications consuming the object. - tools or helper methods
These are helper methods used inside database request methods. They are not accessible
applications consuming the sofajs object. - promises methods
Promises functions stored in sofajs object.
Grouping of methods
methods are grouped by lables you create. For example, a group named 'user' could be
created and the sofajs object would have:
- sofaInternals.requests.user
all request methods build for the user group would be in the
sofaInternals.requests.user
object. - sofaInternals.tools.user
all tool methods built for the user group would be in the
sofaInternals.tools.user
object. - sofaInternals.promises.user
all promise methods built for the user group would be in the
sofaInternals.promises.user
object.
Documentation Server
supports a documentation server which generates html documenation using
hapijs.
Testing
require 100% test coverage using: lab and code
Style Guide
Project follows: hapijs coding conventions