How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • var open = require('amqplib').connect();
    open.then(function(c) {
      c.createConfirmChannel().then(function(ch) {
        ch.sendToQueue('foo', new Buffer('foobar'), {},
          function(err, ok) {
            if (err !== null)
              console.warn('Message nacked!');
            else
              console.log('Message acked');
        });
      });
    });
    
    Docs
  • var open = amqp.connect();
    open.then(function(conn) {
      var ok = doStuffWithConnection(conn);
      return ok.then(conn.close.bind(conn));
    }).then(null, console.warn);
    
    Docs
  • amqp.connect().then(function(conn) {
     // Everything ok, but ..
     throw new Error('SNAFU');
    }, function(err) {
     console.error('Connect failed: %s', err);
    }).then(null, function(err) {
      console.error('Connect succeeded, but error thrown: %s', err);
    });
    
    Docs
  • const sql = require('mssql')
    
    sql.connect(config).then(() => {
        return sql.query`select * from mytable where id = ${value}`
    }).then(result => {
        console.dir(result)
    }).catch(err => {
        // ... error checks
    })
    
    sql.on('error', err => {
        // ... error handler
    })
    Docs
  • const sql = require('mssql')
    
    (() => {
      sql.connect().then(pool => {
        return pool.query('SELECT 1')
      }).then(result => {
        // do something with result
      }).then(() => {
        return sql.close()
      })
    })()
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples