Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
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.
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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).