Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Node.js helper module for IBM BlueMix.
This module automates some common intialization tasks for Node.js applications running on IBM BlueMix. The main features of the module are:
npm install bluemix
The following sample code initializes an Express.js application and connects it to mongodb:
var bluemix = require('bluemix')
, express = require('express')
, app = express()
app.use(app.router);
app.use(express.errorHandler());
bluemix.on('ready', function() {
app.listen(bluemix.config.port, bluemix.config.host);
console.log('App started on port ' + bluemix.config.port + ' and connected to mongodb');
bluemix.db.collection('test').find().toArray(function(err, data) {
if (err) {
// handle error
} else {
// work with data
}
});
});
bluemix.on('error', function(err) {
console.error('App init failed', err);
});
bluemix.init(['mongodb']);
The object bluemix.config
is automatically initilized at startup and contains the following attributes:
host
, hostname/address of the applicationport
, port of the applicationtmpDir
, temporary directory of the applicationReturns a list of services matching name
, which can be a string or a RegExp. Example:
// get an array of available mongodb-2.2 services
var a1 = bluemix.getServices('mongodb-2.2');
// get an array of mysql services, regardless of the version
var a2 = bluemix.getServices(/mysql/);
Returns the first service matching name
, which can be a string or a RegExp. Example:
// get the first available mongodb-2.2 service
var s1 = bluemix.getService('mongodb-2.2');
// get the first mysql service, regardless of the version
var s2 = bluemix.getService(/mysql/);
Connects to all the available (and supported) services.
The method emits a ready
event upon successful connection all the services and if all the dependencies
(if any) are satisfied. It emits an error
event otherwise.
The following table lists the supported services, which drivers (npm modules) are used to connect and how to access them:
Service | Service name | Driver | Connected client instance |
---|---|---|---|
MongoDB | mongodb-2.2 | mongodb | bluemix.db, bluemix.mongodb |
RabbitMQ | rabbitmq-2.8 | amqp | bluemix.mq, bluemix.rabbitmq |
Mysql | mysql-5.5 | mysql | bluemix.db, bluemix.mysql |
Redis | redis-2.6 | redis | bluemix.redis |
If both MongoDB and Mysql are defined, bluemix.db
will point to the first one that was encountered. The same applies if multiple MongoDB (or Mysql) services are defined.
Services can also be accessed as bluemix[service type][service name]
:
bluemix['mongodb-2-2']['mongo-abcde']
FAQs
Node.js helper module for IBM BlueMix
The npm package bluemix receives a total of 4 weekly downloads. As such, bluemix popularity was classified as not popular.
We found that bluemix 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.