Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
fastify-couchdb
Advanced tools
Fastify CouchDB connection plugin, with this you can share the same CouchDB connection in every part of your server.
Under the hood the popular nano module is used, with the options that you pass to register
passed to the nano instance.
npm i fastify-couchdb --save
Simply add it to your project with register
and you're done!
When registering you can pass any options supported by nano
to the plugin:
fastify.register(require('fastify-couchdb'), {
url: 'http://localhost:5984',
requestDefaults : { "proxy" : "http://someproxy" },
// etc
})
This plugin will add the couch
namespace in your Fastify instance which you can treat exactly like an instance of nano. Inside your routes you can then access the full range of nano's methods documented here.
Example:
const fastify = require('fastify')
fastify.register(require('fastify-couchdb'), {
url: 'http://localhost:5984'
})
fastify.get('/rabbit', (req, reply) => {
const rabbits = this.couch.db.use('rabbits')
rabbits.get('whiterabbit', function(err, body) {
reply.send(err || body)
});
})
Async await is support as well if you prefer:
const fastify = require('fastify')
fastify.register(require('fastify-couchdb'), {
url: 'http://localhost:5984'
})
fastify.get('/rabbit', async (req, reply) => {
try {
const rabbits = fastify.couch.db.use('rabbits');
const body = await rabbits.get('whiterabbit')
reply.send(body);
}
catch(err) {
reply.send(err);
}
})
First, start couchdb with:
$ npm run couchdb
Then in another terminal:
$ npm test
Licensed under Apache-2.0.
FAQs
Fastify CouchDB connection plugin
We found that fastify-couchdb 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.