Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
couchdb-request
Advanced tools
Readme
Minimalist couchdb client on top of request. Unlike other couchdb-client, this module expose the powerful request object to enable chaining. This make it easy to use it as a proxy between client (browser) and couchDB server.
This in turn allows us to do additional action like sending email confirmation after user successfully register or add additional check at the login form to rate limit login attempt.
##Install
$npm install couchdb-request
##Method
All method is basically a very light request abstraction and every call will return the same request object. All method from request module is available. Please refer the CouchDB API documentation at docs.couchdb.org for available REST API.
const couchdb = require('couchdb-request')(opts)
This api should be called first to set the correct database parameter before calling any database action method.
Database name to query to
Get database value
Insert data to database
Insert data to database
Delete data from database
Update existing data. This api will automatically get the latest rev to use for updating the data.
Query rows of data using views
##Usage example
const bodyParser = require('body-parser');
const express = require('express');
const couchdb = require('couchdb-request')('https://admin:password@localhost:5984');
var app = express();
app.use(bodyParser.json());
app.post('/register', (req, res) => {
couchdb
.database('_users') //select database
.put('org.couchdb.user:' + req.body.email, req.body) //method
.on('error', err => console.log(err)) //log on error
.on('response', result => sendEmailConfirmation(req.body)) //send email on success
.pipe(res) //stream to browser
})
app.listen(3000);
Using callback function
couchdb
.database('_users')
.get('org.couchdb.user:myuser@hello.com', res => {
console.log(res);
})
FAQs
Minimilist couchdb client on top of request.
The npm package couchdb-request receives a total of 4 weekly downloads. As such, couchdb-request popularity was classified as not popular.
We found that couchdb-request demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.